-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RNMobile] Android Only - Fix Gboard enter detection in EnterPressedWatcher #32471
[RNMobile] Android Only - Fix Gboard enter detection in EnterPressedWatcher #32471
Conversation
Note: This is probably not enough, since this only addresses when the caret is at the end of the word, but Gboard may exhibit the unusual behavior also when the caret is in the middle or start of the word.
…er methods" This reverts commit 5581743.
This reverts commit 93bbd1f.
…extWatcher methods"" This reverts commit 5da76c7.
Writing flow tests for [ENTER] behaviorThese tests should be performed both with and without a Gboard keyboard. It may be worth paying close attention to the known issues with enter key behavior to make sure there aren't any new regressions, and if possible, whether some other issues are fixed by these changes. With Gboard keyboard✅ Multiline components - Test Cases Testing StepsTest the next steps on:
✅ TC001Known Issues
New line on multiline components
✅ Rich Text Formatting - Test Cases Testing StepsPreconditionHave a rich-text based component with content (Paragraph, Heading, Quote, Media Caption, etc...) ✅ TC003Alignment Split
❌ Splitting and merging - Test Cases Testing StepsKnown Issues
PreconditionStart from an empty post. Initial steps
✅ TC001Known Issues
Merge after writing
❌ TC002Known Issues
Merge after selection
✅ TC003Known Issues
Merge after deleting text
✅ TC004Known Issues
Merge after deleting all
✅ TC005Merge multiple blocks
✅ TC006Splitting/merge list block
With non-Gboard keyboard✅ Multiline components - Test Cases Testing StepsTest the next steps on:
TC001Known Issues
New line on multiline components
✅ Rich Text Formatting - Test Cases Testing StepsPreconditionHave a rich-text based component with content (Paragraph, Heading, Quote, Media Caption, etc...) ✅ TC003Alignment Split
❌ Splitting and merging - Test Cases Testing StepsKnown Issues
PreconditionStart from an empty post. Initial steps
✅ TC001Known Issues
Merge after writing
❌ TC002Known Issues
Merge after selection
✅ TC003Known Issues
Merge after deleting text
✅ TC004Known Issues
Merge after deleting all
✅ TC005Merge multiple blocks
✅ TC006Splitting/merge list block
|
This is ready for review, but hold off on merging. I'm waiting to hear if we are okay with fixing this bug at the cost of test TC002 in the Splitting and merging suite of tests failing. (cc: @mchowning @hypest ) |
Hi @AmandaRiu 👋 😄 I noticed that these changes appear to come from the first approach attempted on the original draft PR, but I may have left the description of that PR in the state from the second attempted approach there, even though those changes had been reverted. I think I should have changed the description back when I pushed the reverts, which would be:
In my tests there, this more "targeted" approach had not introduced any new regressions, and resolved the single issue of pressing enter at the end of a suggested ("underlined") word. I also observed at that time that a few of the known issues had been resolved on |
👋 @AmandaRiu , thanks for the thorough testing! Let me ask, will the user eventually be able to merge the blocks? Like, doing another backspace or maybe moving the caret somewhere and then the block would allow merging? If yes, then it feel that's a lesser issue than the newline-on-enter and I think it'd be useful to go ahead and land the fix for the newline issue anyway. We can then work on the merge issue separately. |
Thanks @mkevins, I've updated the description in the PR. 👍 |
that's a good question @hypest . I'll test it out and post the results here. |
Hitting backspace again doesn't fix it, but if I click off the block and then click back into it, I'm able to backspace and merge the blocks back together. |
@AmandaRiu 👋 😄 thank you for testing these flows so thoroughly! Regarding TC002, I was wondering if you are observing that as a new regression (i.e. that it was introduced by these changes). When I tested this, it seemed to be an issue on tc002-split-and-merge-failing-17.5-rc-1.mp4Are you able to reproduce this on a current release as well? |
The video you provided in you comment shows you were testing with "swiping" words, which is a known issue logged in this ticket wordpress-mobile/gutenberg-mobile#2375. The issue I had uncovered was just tapping out the word one letter at a time which wasn't logged as a known issue which is why I flagged it as a regression. I just tried the same scenario on the current production version of WPAndroid, and it IS happening there so this isn't a regression. I didn't think to test that before. With that in mind I think this PR is good to go 👍 Unfortunately, since I'm the PR author, I'm unable to approve this PR so I will need someone else to do it so it may be merged. |
I'll update the current ticket (wordpress-mobile/gutenberg-mobile#2375) with notes that it happens with swiping and tapping out words. |
Ah, good distinction! And thanks for confirming the behavior also exists for tapping! |
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.
Approving via @AmandaRiu 's testing and review 😄
See title in the PR that was linked to it (wordpress-mobile/gutenberg-mobile#3590): > [Android] Fix Gboard enter detection in EnterPressedWatcher If you then follow up on the Gutenberg PR (WordPress/gutenberg#32471) that actually made the change, you'll see confirmation it's Android only: > [RNMobile] Android Only - Fix Gboard enter detection in > EnterPressedWatcher
Gutenberg-mobile PR: wordpress-mobile/gutenberg-mobile#3590
Fixes: wordpress-mobile/gutenberg-mobile#3316. This PR is an updated version of this older draft PR by @mkevins and uses a new branch created by @hypest. I tested the fixes on the following physical devices:
Ran through all these writing flow tests first using the default Gboard. I then installed the Microsoft Swift Keyboard and ran through the tests again. Both keyboard's failed TC002 in the Splitting and merging group of test cases. The test that failed was the one where you first split a paragraph block, then add text to the beginning of the second block and then select that new text and delete it. Tapping delete again will not merge the two blocks back into a single block.
I also tested all the known issues with the two keyboards. Only one existing issue was fixed for both keyboards:
However, all known issues were not an issue for the Swift keyboard.
Description
The approach used in this PR adds logic to detect when we've encountered the unusual behavior exhibited by Gboard which leads to a failure to detect onEnter keypresses. When such behavior is detected, it calculates new offsets to be used in string comparison and processing to conform to the original intention of this TextWatcher.
Note: This is probably not enough, since this only addresses when the caret is at the end of the word, but Gboard may exhibit the unusual behavior also when the caret is in the middle or start of the word. Some consideration should be made for those other conditions as well.
How has this been tested
The Writing Flow Tests in a comment below should be completed using a physical device with a and without a GBoard keyboard:
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).