Skip to content
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

[HOLD for payment 2024-08-01] [$250] Cannot select a word in native iOS composer if composed message have an emoji #44495

Closed
1 of 6 tasks
m-natarajan opened this issue Jun 26, 2024 · 35 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Jun 26, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.2-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Expensify/Expensify Issue URL:
Issue reported by: @mountiny
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1719405668302249

Action Performed:

  1. Launch the app
  2. Initiate a DM with any user
  3. Compose a message with emoji
  4. Try selecting a word by long press or double tab

Expected Result:

Able to select word by long press or by double tapping

Actual Result:

Unable to select by long press or by double tapping

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
RPReplay_Final1717078125.MP4
RPReplay_Final1719422598.MP4
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a59336e899fcaa47
  • Upwork Job ID: 1806116311980257786
  • Last Price Increase: 2024-06-27
  • Automatic offers:
    • QichenZhu | Contributor | 102976322
Issue OwnerCurrent Issue Owner: @lschurr
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 26, 2024
Copy link

melvin-bot bot commented Jun 26, 2024

Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Jun 27, 2024
Copy link

melvin-bot bot commented Jun 27, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01a59336e899fcaa47

@melvin-bot melvin-bot bot changed the title Cannot select a word in native iOS composer if composed message have an emoji [$250] Cannot select a word in native iOS composer if composed message have an emoji Jun 27, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 27, 2024
Copy link

melvin-bot bot commented Jun 27, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

@mountiny
Copy link
Contributor

cc @BartoszGrajdek @tomekzaw

@BartoszGrajdek
Copy link
Contributor

Let's add this to the Live Markdown project @mountiny

@sandipanghos
Copy link

@mountiny is this still open for proposal? I am working on it

@QichenZhu
Copy link
Contributor

QichenZhu commented Jun 28, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Cannot select a word in the native iOS composer if the message contains an emoji.

What is the root cause of that problem?

Originally, React Native had an issue with TextInput when using emojis.

All emoji characters are automatically given an AppleColorEmoji NSFont attribute and the original font is moved to NSOriginalFont attribute.

This causes an issue when we call isEqualToAttributedString when we set the attributedText, since it will always be false if an emoji is present.

React Native fixed this by ignoring all attributes in such cases.

https://github.com/facebook/react-native/blob/9269429bb955d47088793a2e32454fddb712152b/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm#L130-L167

Screenshot 2024-06-29 at 3 13 09 AM

However, this fix caused Expensify/react-native-live-markdown#293 and #41390, and was reverted by Expensify/react-native-live-markdown#318.

What changes do you think we should make in order to solve the problem?

Making clones of newText and oldText and removing the NSOriginalFont and NSFont attributes from them before calling isEqualToAttributedString.

-    return [newText isEqualToAttributedString:oldText];
+    NSMutableAttributedString *newTextCopy = [newText mutableCopy];
+    NSMutableAttributedString *oldTextCopy = [oldText mutableCopy];
+    [newTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, newTextCopy.length)];
+    [oldTextCopy removeAttribute:@"NSFont" range:NSMakeRange(0, oldTextCopy.length)];
+    [oldTextCopy removeAttribute:@"NSOriginalFont" range:NSMakeRange(0, oldTextCopy.length)];
+    return [newTextCopy isEqualToAttributedString:oldTextCopy];

What alternative solutions did you explore? (Optional)

N/A

Copy link

melvin-bot bot commented Jul 2, 2024

@mollfpr, @lschurr Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jul 2, 2024
@lschurr
Copy link
Contributor

lschurr commented Jul 2, 2024

@mountiny is this open for proposals? Should @mollfpr be reviewing?

@melvin-bot melvin-bot bot removed the Overdue label Jul 2, 2024
@tomekzaw
Copy link
Contributor

tomekzaw commented Jul 3, 2024

@QichenZhu Could you please provide more details about the suggested fix for this problem?

@QichenZhu
Copy link
Contributor

Proposal

@tomekzaw Sure, here's the updated proposal. Thanks!

@tomekzaw
Copy link
Contributor

tomekzaw commented Jul 3, 2024

Thanks, sounds good to me. Can we proceed with the PR so we can test out the changes?

@mollfpr
Copy link
Contributor

mollfpr commented Jul 3, 2024

I don't have much experience with objective-c, but I believe @tomekzaw reviewed.

Probably @QichenZhu can provide a video of the result before the assignment?

@QichenZhu
Copy link
Contributor

@mollfpr

Before:

before.mp4

After:

after.mp4

@mollfpr
Copy link
Contributor

mollfpr commented Jul 3, 2024

Thanks, @QichenZhu. It looks good to me!

Let's move forward with @QichenZhu proposal then!

🎀 👀 🎀 C+ reviewed!

Copy link

melvin-bot bot commented Jul 3, 2024

Triggered auto assignment to @stitesExpensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

📣 @QichenZhu 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@lschurr
Copy link
Contributor

lschurr commented Jul 10, 2024

Any update @tomekzaw?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jul 10, 2024
@lschurr
Copy link
Contributor

lschurr commented Jul 15, 2024

Bump @tomekzaw @mollfpr

@melvin-bot melvin-bot bot removed the Overdue label Jul 15, 2024
@tomekzaw
Copy link
Contributor

tomekzaw commented Jul 15, 2024

Reviewing the PR, sorry for the delay

@tomekzaw
Copy link
Contributor

PR has been reviewed and merged ✅

@QichenZhu
Copy link
Contributor

There is a PR #45556 to update react-native-live-markdown to 0.1.105. Should we wait until it's merged and then bump the version to 0.1.107?

@tomekzaw
Copy link
Contributor

@QichenZhu Let's ask @thienlnam

@thienlnam
Copy link
Contributor

Yeah. since that PR has already been reviewed let's wait to bump it until after that is merged. Then it can go through another series of tests since we've seen issue things pop up when jumping versions before

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Jul 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] Cannot select a word in native iOS composer if composed message have an emoji [HOLD for payment 2024-08-01] [$250] Cannot select a word in native iOS composer if composed message have an emoji Jul 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jul 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.11-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-01. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jul 25, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@lschurr] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@BartoszGrajdek BartoszGrajdek moved this from HIGH to Done in Live Markdown Jul 31, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 31, 2024
@lschurr
Copy link
Contributor

lschurr commented Aug 1, 2024

Payment summary:

@lschurr lschurr closed this as completed Aug 1, 2024
@mollfpr
Copy link
Contributor

mollfpr commented Aug 5, 2024

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

No offending PR!

[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

The regression step should be good!

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

  1. Launch the app
  2. Initiate a DM with any user
  3. Compose a message with an emoji
  4. Try selecting a word by long-pressing or double-tapping
  5. Verify that the word is selected
  6. 👍 or 👎

@lschurr
Copy link
Contributor

lschurr commented Aug 5, 2024

Thanks @mollfpr - adding QA test request

@JmillsExpensify
Copy link

$250 approved for @mollfpr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests