-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[$500] Do not allow emojis to be formatted (ie italics) #14676
Comments
Confirmed that this happens on Android native app. Confirmed it does not happen on Mac/Chrome. But related, when I try the same reproduction steps on iOS native, iOS Chrome and Mac Safari - I cannot italicize emojis at all. Is that expected? |
Job added to Upwork: https://www.upwork.com/jobs/~017d08e0c09284d31f |
Current assignee @anmurali is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif ( |
Triggered auto assignment to @flodnv ( |
ProposalQuick fix: diff --git a/src/styles/styles.js b/src/styles/styles.js
index b826ed336f..84286591e9 100644
--- a/src/styles/styles.js
+++ b/src/styles/styles.js
@@ -63,6 +63,7 @@ const webViewStyles = {
em: {
fontFamily: fontFamily.EXP_NEUE,
fontStyle: 'italic',
+ width: variables.fontSizeNormalHeight,
},
del: { |
I don't think we should be able to italicize emojis, asked here: https://expensify.slack.com/archives/C01GTK53T8Q/p1675266083150699 |
Agree with @flodnv. |
ProposalThe Emoji is italicized because it is contained in the In order to remove the ability to italicize emojis, I'll wrap any emoji that are inside the (The emoji regex below is taken from the In https://github.com/Expensify/expensify-common diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js
index 7f94ffe..057e87c 100644
--- a/lib/ExpensiMark.js
+++ b/lib/ExpensiMark.js
@@ -134,6 +134,11 @@ export default class ExpensiMark {
regex: /(?!_blank")\b_((?!\s).*?\S)_\b(?![^<]*(<\/pre>|<\/code>|<\/a>|_blank))/g,
replacement: '<em>$1</em>',
},
+ {
+ name: 'emoji',
+ regex: /(<em>.*?)([\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3)(.*?<\/em>)/gu,
+ replacement: '$1<expensify-emoji>$2</expensify-emoji>$3',
+ },
{
// Use \B in this case because \b doesn't match * or ~.
// \B will match everything that \b doesn't, so it works
In https://github.com/Expensify/App diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
index 456cd1ecf3..0bf75ea9d2 100755
--- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
+++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
@@ -39,6 +39,10 @@ const customHTMLElementModels = {
tagName: 'email-comment',
mixedUAStyles: {whiteSpace: 'normal'},
}),
+ 'expensify-emoji': defaultHTMLElementModels.span.extend({
+ tagName: 'expensify-emoji',
+ mixedUAStyles: {fontStyle: 'normal'},
+ }),
};
const defaultViewProps = {style: [styles.alignItemsStart, styles.userSelectText]};
There're small possible variations based on our preference:
There're some further minor fixes required:
I'll add those if we want to go with this direction. Pls note we have to fix the same in the BE as well, in order to test the above fix we need to enable offline mode. |
working well after the fix: Screen.Recording.2023-02-02.at.18.08.29.mov |
@tienifr Your approach looks solid however the regex is not correct as it will only match one emoji, try sending Here are my suggestions:
{
name: 'emoji',
regex: /[\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu,
replacement: match => `<expensify-emoji>${match}</expensify-emoji>`,
},
|
Thanks @s77rt for your suggestion! Updated proposalAdding to the original proposal, Here's the my updated diff for the regex so that it matches all rather than just one. diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js
index c535048..62b183f 100644
--- a/lib/ExpensiMark.js
+++ b/lib/ExpensiMark.js
@@ -242,6 +242,11 @@ export default class ExpensiMark {
regex: /<(em|i)(?:"[^"]*"|'[^']*'|[^'">])*>(.*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
replacement: '_$2_',
},
+ {
+ name: 'emoji',
+ regex: /([\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3)/gu,
+ replacement: '<expensify-emoji>$1</expensify-emoji>',
+ },
{
name: 'bold',
regex: /<(b|strong)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
|
@s77rt Regarding the |
|
@s77rt I tried to zoom the emojis in but can't recognize any difference between an emoji that has Thanks for the input! diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
index 456cd1ecf3..0bf75ea9d2 100755
--- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
+++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
@@ -39,6 +39,10 @@ const customHTMLElementModels = {
tagName: 'email-comment',
mixedUAStyles: {whiteSpace: 'normal'},
}),
+ 'expensify-emoji': defaultHTMLElementModels.span.extend({
+ tagName: 'expensify-emoji',
+ mixedUAStyles: {fontStyle: 'normal', fontWeight: 'normal'},
+ }),
};
const defaultViewProps = {style: [styles.alignItemsStart, styles.userSelectText]}; |
@tienifr While seaching I found this image. The middle emoji is in bold but it's hard to notice also it may depend on the font. Adding |
@flodnv, @anmurali, @aimane-chnaif Eep! 4 days overdue now. Issues have feelings too... |
@flodnv, @anmurali, @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this? |
reviewing proposals shortly |
@BartoszGrajdek where are we at with prioritization these days? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
We have much more time to handle things now, sorry for the wait 🙌 @Skalakid decided to investigate if there's a cleaner way to handle this problem. If that won't be the case we'll follow through with the PR created by Robert after making some adjustments. |
@Skalakid could you please provide an update? |
@stitesExpensify sorry, I had to prioritize the Live Markdown refactor PR and inline images feature. However, I prepared a small fix for the web. We can just add some styles to emoji default styles that will overwrite italic and other ones, like |
Hey @Skalakid any more updates? :) |
Bump :) |
Hello, unfortunately we don't have any capacity to work on this issue now, because we are focused on fixing issues with higher priority |
Thanks @Skalakid , I agree this isn't the highest priority. I was going to do something then realized we have 300 comments (which I didn't read all of before posting this) on this issue so I wanted to pause and reevaluate. Should we
cc @Skalakid , @BartoszGrajdek , @stitesExpensify @eh2077 @wildan-m |
@mallenexpensify I think we can go with option number 1, we are finishing our current work and might have some time to investigate this issue on the Android native side |
Will keep checking back ~monthly. |
Hey @Skalakid any chance you got around to it this month? |
Hello, I will take a look at it 👀 |
FYI we added |
Hi, here is the PR with the fix 😄 |
nice, that's awesome!! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
Users should not be able to format emojis, lets keep them with normal style (no bold, italics, strikethrough etc)
Actual Result:
Users can make emoji italic which leads to the emojis to cut off a few parts of the emoji (for some emojis)
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.62-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Expensify/Expensify Issue URL:
Issue reported by: @priya-zha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1675094271396099
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @mallenexpensify / @mallenexpensifyThe text was updated successfully, but these errors were encountered: