-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
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 |
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.
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
@@ -94,11 +99,13 @@ class BaseOptionsSelector extends Component { | |||
shouldShowReferralModal: false, | |||
errorMessage: '', | |||
paginationPage: 1, | |||
disableEnterShortCut: isNative ? false : this.handleFocusIn(), |
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.
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 |
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
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 👍
Whoops, we have a conflict. @dukenv0307 Could you resolve it? Thanks! |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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
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