Sync keyboard navigation in SelectionList and PopoverMenu#39201
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-04-02.at.23.22.15.mp4Android: mWeb ChromeCleanShot.2024-04-02.at.23.21.21.mp4CleanShot.2024-04-03.at.21.46.57.mp4iOS: NativeCleanShot.2024-04-02.at.02.49.27.mp4CleanShot.2024-04-02.at.20.08.49.mp4iOS: mWeb SafariCleanShot.2024-04-01.at.23.43.55.mp4MacOS: Chrome / SafariCleanShot.2024-04-01.at.23.34.53.mp4MacOS: DesktopCleanShot.2024-04-02.at.04.41.21.mp4 |
|
@WojtekBoman Could you please merge main ? Bug: PopoverMenu inside report screens still have the same bug
Screen.Recording.2024-04-01.at.11.38.42.PM.movCrash: App crash on ios When I open currency selector inside the request money flow
CleanShot.2024-04-02.at.02.48.42.mp4
This is not working on mobile (chrome and safari) Video
CleanShot.2024-04-01.at.23.44.29.mp4CleanShot.2024-04-02.at.04.32.36.mp4 |
|
@WojtekBoman The crash was fixed on IOS. However, the bug still persists in the Video 1CleanShot.2024-04-02.at.23.37.15.mp4Video 2CleanShot.2024-04-02.at.23.23.52.mp4Video 3CleanShot.2024-04-02.at.23.14.08.mp4 |
|
I'm still investigating this bug that appears on mobile browsers, I'll let you know when it's ready to check :) |
Kicu
left a comment
There was a problem hiding this comment.
Review after fixing the focus bug.
LGTM 👍 good job
| if (isDisabled || !hasHoverSupport()) { | ||
| return cloneElement(getReturnValue(props.children, false), {ref}); | ||
| const child = getReturnValue(props.children, false); | ||
| return cloneElement(child, {ref: mergeRefs(ref, child.ref)}); |
|
@fedirjh I believe that now it should work, but I'm not sure about bugs on |
|
We merged this to fix some bugs with the key arrow functionality, since this is a considerable refactor of similar logic, please make sure the bug doesn't show up here. |
|
conflicts |
3f4072c
Yes, I'll take a look at it. I'll let you know when it's ready :) |
|
@fedirjh Perf-tests have been 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/roryabraham in version: 1.4.63-0 🚀
|
|
Possible regression from here, can @WojtekBoman and @fedirjh , 👀 plz. |
|
Another possible regression: #40410 |
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|
| scrollToIndex(index, true); | ||
| }, | ||
| isFocused, | ||
| }); |
There was a problem hiding this comment.
When we are using the useArrowKeyFocusManager here, we should have passed the disabledIndexes props, which caused this issue: #40583
| onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} | ||
| nativeID={keyForList ?? ''} | ||
| style={pressableStyle} | ||
| onFocus={onFocus} |
There was a problem hiding this comment.
Coming from this issue #41922, we have added the onFocus to BaseListItem in this PR. We already had the onMouseDown conditional prop passed, so the bug might have been there with the conditional onMouseDown prop but became visible after the onFocus change. When we long press the currency in CurrencySelection, it triggers the onFocus function, and we see a scroll to the long-pressed index. We have fixed this by removing the conditional onMouseDown in BaseListItem.
| return; | ||
| } | ||
|
|
||
| ref.current?.focus(); |
There was a problem hiding this comment.
Came from this issue
To prevent issues related with selector scrolls to the top when we scroll down quickly
We added preventScroll: true for focus
More details here
Details
This PR fixes focusing on SelectionList and PopoverMenu items when navigating with tab button and arrows. Previously, these buttons worked independently, now only one item on the list is focused when navigating using them.
How it works without a fix:
Screen.Recording.2024-03-29.at.10.36.13.mov
Fixed Issues
$ #36476 (comment)
PROPOSAL: N/A
Tests
Offline tests
QA Steps
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
MacOS: Chrome / Safari
Screen.Recording.2024-03-29.at.09.59.26.mov
MacOS: Desktop
Screen.Recording.2024-03-29.at.09.50.19.mov