[No-QA] refactor: Navigation code in SelectionList component #92662
[No-QA] refactor: Navigation code in SelectionList component #92662TaduJR wants to merge 10 commits into
Conversation
…vigation-code-in-SelectionList-component
|
@mkhutornyi 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] |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04144e2b06
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Please merge main |
ReviewReviewed the SelectionList navigation/focus consolidation. The extraction is faithful — the imperative ref API, props interface, arrow-key/scroll-suppression logic, Enter/Ctrl+Enter shortcuts, and focus-restore-aware setters all match the originals after substitution. No correctness regressions found. Two minor behavioral deltas worth a look (posted inline):
Things I checked that are fine
Next Steps: Reply with |
…vigation-code-in-SelectionList-component
Done. |
Explanation of Change
BaseSelectionList(flat) andBaseSelectionListWithSections(sectioned) carried near-identical, copy-pasted forks of the same focus/navigation logic, which had already started to drift. This PR consolidates that duplicated navigation/interaction logic into shared, single-source modules undersrc/components/SelectionList/:useSelectionListKeyboardFocus— the navigation core: wrapsuseArrowKeyFocusManagerand owns the scroll-suppression ref, the focus-restore-aware cursor setters (setFocusedIndexFromRowFocus/setFocusedIndexWithoutScrollOnChange),suppressNextFocusScroll, and the keyboard-navigation modality (thehasKeyBeenPressedflag + Tab listener).useSelectionListScroll— the bounds-checkedscrollToIndexand its debounced variant.useSelectionListShortcuts— theEnter/Ctrl+Entershortcuts anddisableEnterShortcutgating.useSelectionListTextInput— the search-input refs and key handlers.SelectionListEmptyState— the shared loading-skeleton / empty-state rendering.Both
BaseSelectionListandBaseSelectionListWithSectionsnow consume these instead of maintaining their own copies; the per-list differences (data source,isActiveexpression, section flattening) are passed in as parameters.Fixed Issues
$ #91033
PROPOSAL:
Tests
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari