Fix pressing enter doesn't select the emoji category#50971
Conversation
|
@ahmedGaber93 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] |
| if (!isEnterWhileComposition(keyBoardEvent) && keyBoardEvent.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey) { | ||
| // On web, avoid this Enter default input action; otherwise, it will add a new line in the subsequently focused composer. | ||
| keyBoardEvent.preventDefault(); | ||
| // On mWeb, avoid propagating this Enter keystroke to Pressable child component; otherwise, it will trigger the onEmojiSelected callback again. | ||
| keyBoardEvent.stopPropagation(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Why you remove the whole condition, Shouldn't we keep the return early here?
There was a problem hiding this comment.
I removed it because it won't affect the code below it.
App/src/components/EmojiPicker/EmojiPickerMenu/index.tsx
Lines 150 to 161 in c3d33fc
For
App/src/components/EmojiPicker/EmojiPickerMenu/index.tsx
Lines 157 to 160 in c3d33fc
it's only executed if shouldAutoFocusOnKeyPress is true which is false for ENTER.
Lines 7595 to 7598 in c3d33fc
For
App/src/components/EmojiPicker/EmojiPickerMenu/index.tsx
Lines 150 to 155 in c3d33fc
the keyboard movement state is used to show the focused state of emoji item.
The emoji will be focused when we use arrow key, tab, or hold down mouse on it. The time we press Enter, the emoji will be selected. From my understanding, the isUsingKeyboardMovement state is used to not show the blue outline on the emoji when focused using mouse.
But it will still show anyway with the mouse because when focused, we update the focused index.
which always update isUsingKeyboardMovement to true.
App/src/components/EmojiPicker/EmojiPickerMenu/index.tsx
Lines 75 to 87 in c3d33fc
We can remove Enter from the if if you want.
There was a problem hiding this comment.
We can remove Enter from the
ifif you want.
To be honest, I don't understand what is the purpose of keyBoardEvent.key === 'Enter' ||, As I see in the code clicking Enter should do one of
- select the emoji and close the menu
- select the category
In the both cases this condition keyBoardEvent.key === 'Enter' || it is not reachable in the old code here, and beside your explanation about isUsingKeyboardMovement it seems to don't do any function but let's know what @aldo-expensify think before remove it
There was a problem hiding this comment.
In the both cases this condition keyBoardEvent.key === 'Enter' || it is not reachable in the old code here
Yeah, good point.
There was a problem hiding this comment.
Sorry for the delay here, I'm just starting to look at this 👁️
There was a problem hiding this comment.
I'm very unfamiliar with the details here, and I'm wanting to avoid spending to much time to understand all the details around it. I tested and it appears to be working well for me, so I'm going to just assume that we don't need to change anything here since it is working.
|
Bug: the first emoji on the selected category is not autofocused after selecting the category like what we do in search emoji.
Expected: after selecting any category, first emoji of it should be focused and arrow-left and arrow-right should move focusing between category emojis. Current: the first emoji on the selected category is not autofocused after selecting the category and arrow-left and arrow-right do nothing (instead the first emoji on the first category not the selected category is focused) 20241018122154891.mp4I think this feature is not broken, but it is not implemented before. |
Yes, it was never implemented, so it's not a bug. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativea.mp4Android: mWeb Chromeaw.mp4iOS: Nativei.mp4iOS: mWeb Safariiw.mp4MacOS: Chrome / Safariw.mp4MacOS: Desktopd.mp4 |
ahmedGaber93
left a comment
There was a problem hiding this comment.
LGTM! Just need a confirmation here #50971 (comment)
|
I will report this bug #50971 (comment) in slack after deploying this PR to staging |
|
So, I've testing this and this seems to be pretty important: #50971 (comment) Once you select a category using the keyboard, it is not possible to choose emojis properly unless we go with the mouse. Then, being able to scroll by hitting enter on the category becomes somewhat pointless if your intention was to navigate with the keyboard. I'm inclined to consider this as part of the scope of the work being done here. |
|
Makes sense to me. 👍 |
It feels more like a missing feature, luckily it's very simple to do. Here is how it looks web.mp4 |
Thank you @bernhardoj , it works pretty well now. Screen.Recording.2024-10-25.at.12.33.04.PM.mov
If you are hinting there should be extra compensation, feel free to request in the right channel (I'm not sure which one is the right channel :) ) |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 9.0.55-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.0.55-10 🚀
|
Details
Pressing ENTER doesn't select the emoji category in emoji picker.
Fixed Issues
$ #50561
PROPOSAL: #50561 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
iOS: no keyboard shortcut
Android: no keyboard shortcut either, but it natively supports it
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4