-
Notifications
You must be signed in to change notification settings - Fork 3k
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-06-20] [$250] iOS - Chat - The cursor moves one space backward when inserting text after an emoji #42664
Comments
Triggered auto assignment to @kadiealexander ( |
We think that this bug might be related to #vip-vsb |
@kadiealexander FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors. |
Job added to Upwork: https://www.upwork.com/jobs/~011bc1604b6420e233 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.The cursor selection moves to the left by one character when adding a character after inserting an emoji. What is the root cause of that problem?When we add a text to the composer, it will save the new selection position to a ref if the App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 439 to 444 in 2514f29
If they are different, we want to manually correct the selection, however, on iOS, the selection prop is buggy so we use the ref sync solution that imperatively updates the selection that is introduced in #30835. It will update/sync the selection in App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 553 to 563 in 2514f29
However, there are a few things to notice here. First, when we add an emoji from the emoji picker, App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Line 417 in 2514f29
So, This will then set the selection to the ref (syncSelectionWithOnChangeTextRef). Next, if we add an emoji from the emoji picker, So, when we add a character, it will run the selection sync logic which contains the old selection. App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 553 to 563 in 2514f29
What changes do you think we should make in order to solve the problem?We need to compare
What alternative solutions did you explore? (Optional)Clear the ref every time we call App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 408 to 411 in 2514f29
|
Please re-state the problem that we are trying to solve in this issue.iOS - Chat - The cursor moves one space backward when inserting text after an emoji What is the root cause of that problem?When inputting text into the composer, the system saves the new selection position to a reference (ref) if the commentValue doesn't match the newComment. This disparity occurs due to the presence of an extra whitespace added to newComment during emoji insertion, which is absent in commentValue. What changes do you think we should make in order to solve the problem?Instead of comparing commentValue and newComment, directly track the insertion point to determine cursor positioning. App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx Lines 439 to 444 in 2514f29
This approach ensures accurate cursor positioning by directly tracking insertion points and dynamically adjusting cursor positions, thereby resolving the cursor issue caused by indirect comparisons and ensuring correct placement after inserting emojis or additional text. video:-https://drive.google.com/file/d/19PDhzOkps6aXYRAWwyeWr3qyrc_xXzAP/view?usp=sharing |
@bernhardoj 's proposal looks good to me. Nice write up to unwrap the root cause! I also agree with the idea of fixing it by narrowing the scope of the manual-selection-correction-specific code. 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@MonilBhavsar Friendly bump, wdyt #42664 (comment) |
Yes, looking at this... |
@bernhardoj proposal's looks good and simple. |
📣 @eh2077 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Do you mean the alternative solution? Btw, after retesting my main solution, it causes a regression, the cursor is before the emoji when adding an emoji Screen.Recording.2024-06-03.at.19.14.04.movso I use the alternative instead. PR is ready. cc: @eh2077 |
Makes sense, thanks! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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-06-20. 🎊 For reference, here are some details about the assignees on this issue:
|
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:
|
Checklist
Regression test
Do we agree 👍 or 👎 |
Payouts due:
|
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v1.4.76-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: https://expensify.testrail.io/index.php?/tests/view/4577924
Issue reported by: Applause - Internal Team
Action Performed:
Pre-requisite: the user must be logged in.
Expected Result:
The cursor should remain at the end of the compose box content.
Actual Result:
The cursor moves one space backward when inserting text after an emoji.
Workaround:
n/a
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6493190_1716832834593.Ndpf2964_1_.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @kadiealexanderThe text was updated successfully, but these errors were encountered: