fix(react-aria): suppress focus ring updates during Shift+Tab collection pivot#10283
Open
coolassassin wants to merge 1 commit into
Open
fix(react-aria): suppress focus ring updates during Shift+Tab collection pivot#10283coolassassin wants to merge 1 commit into
coolassassin wants to merge 1 commit into
Conversation
920174e to
638f9bf
Compare
…ion pivot Avoid unnecessary re-renders when exiting a collection via Shift+Tab by suppressing transient focus ring state while focus briefly moves to the collection root. Browser tab order is unchanged; only React focus hooks skip updates during the pivot. Co-authored-by: Cursor <cursoragent@cursor.com> � Conflicts: � packages/react-aria/src/selection/useSelectableCollection.ts � packages/react-aria/test/selection/useSelectableCollection.test.js
638f9bf to
3cff724
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Shift+Tab is pressed inside a collection with
allowsTabNavigation={false}(Table, ListBox, GridList, etc.),useSelectableCollectioncallsref.current.focus()on the collection root so the browser can continue tabbing from the collection boundary. That brief focus on the grid root is intentional, but it caused extra focus transitions and downstream React re-renders (for example RowuseFocusRing({ within: true })when focus briefly lands on the grid root).Closes #10254.
This PR keeps the existing pivot (
collectionRoot.focus()+ browser default tab order) and suppresses transient focus ring / focus-visible React state updates while focus moves from an internal tab stop to the collection root during Shift+Tab exit. No manual tab-stop walking; shadow DOM / iframe behavior is unchanged.Behavior:
useFocus/useFocusWithinskiponFocusChangewhen focus moves descendant → collection root.setFocused(false)on collection blur is unchanged.ignoreFocusEventis also set during the pivot so global keyboard focus-visible modality is not affected.✅ Pull Request Checklist:
📝 Test Instructions:
Automated
The new
useSelectableCollectiontest usesfireEvent.keyDown(notuser.tab({ shift: true })) so it exercisesuseSelectableCollection's Tab handler — same caveat asGridList.test.js.Manual (Table / Storybook)
Regression
🧢 Your Project:
dxFeed (Devexperts) — internal Table built on react-aria-components (
Table,div-grid,focusMode="cell").