-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix problem with cursor jumping back to start when adding an emoji in edit mode #37666
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@abdulrahuman5196 @neil-marcellini updated/refactored PR |
@neil-marcellini I still think this has become a complicated fix for a minor issue. Should we do this way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving a partial review, I'll review more later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although a lot of files are changed here and I do have some questions and suggestions, overall the approach seems fine and it looks like it creates the proper result.
@abdulrahuman5196 I think we should proceed with the solution, unless you feel that there are major flaws I'm missing.
❗❗ Heads up, I'm going to be OOO working from Spain 🇪🇸 part time until 3/28. Most days I will be working 50%, some days 100%. Please DM me if something needs urgent attention.❗❗ |
Updated PR with changes from review, please continue with the review @neil-marcellini @abdulrahuman5196 |
Reviewing again |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-03-24.at.8.33.12.PM.mp4Android: mWeb ChromeScreen.Recording.2024-03-24.at.8.40.59.PM.mp4iOS: NativeScreen.Recording.2024-03-24.at.8.30.44.PM.mp4iOS: mWeb SafariScreen.Recording.2024-03-24.at.8.32.13.PM.mp4MacOS: Chrome / SafariScreen.Recording.2024-03-24.at.8.22.46.PM.mp4MacOS: DesktopScreen.Recording.2024-03-24.at.8.24.14.PM.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @neil-marcellini
🎀 👀 🎀
C+ Reviewed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me and it seems to test well. Thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Details
In the chrome browser on Android devices nad Android app when the user edits the message and chooses an emoji from the emoji modal, the cursor jumps back at the beginning of the input. The problem is that addEmojiToTextbox is called from EmojiPickerButton component's onEmojiSelected callback prop, which is called just before onModalHide. The former in turn calls focusComposerWithDelay, which calls focus() on the text input. That method is annotated with the commend 'The exact behavior triggered will depend on the platform and type of view.', which apparently on Android mWeb Chrome and Android app moves the cursor to the start and is the root cause of the problem in this issue. Adding an additional parameter to this function to force-set the position to the state-carried one on this platform fixes the problem and even - when applied - renders the original proposal solution unnecessary.
Fixed Issues
$ #28563
PROPOSAL: #28563 (comment)
Tests
Send a message to a chat
Long-press it and select "Edit comment" in the context menu
Append a new emoji from the emoji picker sliding menu - repeat this in several edge cases: in-between existing text, after text, before text
Ensure the cursor position is each time in the expected position and does not jump to the start of the text
Verify that no errors appear in the JS console
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-native.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
chrome.mov
safari.mov
MacOS: Desktop
desktop.mov