Prevent enter key event if the focused element is a clickable element#32464
Conversation
|
@dukenv0307 The PR for #32294 is merged. Would you like us to continue the testing? |
|
Yes I will complete the PR tomorrow. |
|
@mollfpr Please help to continue reviewing the PR. |
Reviewer Checklist
Screenshots/VideosAndroid: Native32464.Android.mp4Android: mWeb Chrome32464.mWeb-Chrome.mp4iOS: Native32464.iOS.mp4iOS: mWeb Safari32464.mWeb-Safari.mp4MacOS: Chrome / Safari32464.Web.mp4MacOS: Desktop32464.Desktop.mp4 |
mollfpr
left a comment
There was a problem hiding this comment.
Selecting the member with the arrow keys is not working, and with the highlight tab, the member is sometimes set twice.
Screen.Recording.2023-12-18.at.09.51.03.mp4
| shouldShowReferralModal: false, | ||
| errorMessage: '', | ||
| paginationPage: 1, | ||
| disableEnterShortCut: isNative ? false : this.handleFocusIn(), |
There was a problem hiding this comment.
Why we are doing this? handleFocusIn is not returning anything.
|
@mollfpr I have a question here. If we use the tab key focus on an element and use the arrow key to focus on another element. What element we should select/de-select when pressing on enter key. |
In this case, the item is selected from the arrow key. |
|
@mollfpr But the element that is focused by the tap key also triggers the onPress function when we press on enter key. |
|
@dukenv0307 So we can only make it select/deselect on items that are highlighted from the tab navigation? I can't select/deselect it with the arrow key, even if it doesn't have a pressable element highlighted. |
|
@mollfpr Actually, if we don't have a pressable element highlighted the form will be submitted by |
This should be fine. Screen.Recording.2023-12-28.at.21.01.19.mp4There are still some issues that occurred on my test.
|
@mollfpr Updated to fix this case |
mollfpr
left a comment
There was a problem hiding this comment.
@dukenv0307 I don't find the different result between this PR and current staging. Do you mind explain with changes?
| } | ||
|
|
||
| subscribeActiveElement() { | ||
| if (![CONST.PLATFORM.DESKTOP, CONST.PLATFORM.WEB].includes(getPlatform())) { |
There was a problem hiding this comment.
I think we can make ![CONST.PLATFORM.DESKTOP, CONST.PLATFORM.WEB].includes(getPlatform()) this a variable and use it in unSubscribeActiveElement
|
In staging, if we focus by tab key in a option and focus by arrow key in the same option it will be select/de-select immediately. And in this PR we fixed this issue Screen.Recording.2024-01-04.at.16.47.10.mov |
|
Okay, I see the difference, but I still don't understand why |
@dukenv0307 What about the above issue? |
|
We can fix this easily by only disable enter short cut. |
|
Okay, let's do that! |
|
Whoops, we have a conflict. @dukenv0307 Could you resolve it? Thanks! |
mollfpr
left a comment
There was a problem hiding this comment.
It still looks good and tests well! Although the cmd+enter is not working, checking the staging, it's also happening, so the regression is not from this PR.
|
@dukenv0307 It looks good to be, but I'm really not sure what is going on with the failed TypeScript Check. |
|
@joelbettner Fixed. |
|
✋ 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/joelbettner in version: 1.4.25-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.25-10 🚀
|
| if (prevState.disableEnterShortCut !== this.state.disableEnterShortCut) { | ||
| if (this.state.disableEnterShortCut) { | ||
| this.unsubscribeEnter(); | ||
| } else { | ||
| this.subscribeToEnterShortcut(); |
There was a problem hiding this comment.
This caused regression of enter key sometimes not working while navigating - #35373
More details about the root cause: #35373 (comment)
There was a problem hiding this comment.
Caused similar regression where enter key not working while saving ws name #36923
Details
Prevent enter key event if the focused element is a clickable element
Fixed Issues
$ #21392
PROPOSAL: #21392 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.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 so 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
Screen.Recording.2023-12-07.at.13.03.07.mov
Android: mWeb Chrome
Screen.Recording.2023-12-07.at.12.56.54.mov
iOS: Native
Screen.Recording.2023-12-07.at.13.06.12.mov
iOS: mWeb Safari
Screen.Recording.2023-12-07.at.12.56.23.mov
MacOS: Chrome / Safari
Screen.Recording.2023-12-07.at.12.17.32.mov
MacOS: Desktop
Screen.Recording.2023-12-07.at.13.11.51.mov