[composite] Clean up useListNavigation#5028
Open
atomiks wants to merge 1 commit into
Open
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,035.48 ms ▼-418.76 ms(-28.8%) | Renders: 50 (+0) | Paint: 1,550.23 ms ▼-634.15 ms(-29.0%)
…and 7 more — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Cleans up useListNavigation by removing redundant ref bookkeeping, clarifying intentional initial-focus behavior around disabled items, and fixing owner-document resolution when restoring focus in nested floating trees.
Changes:
- Removed vestigial
previousOnNavigateRefusage now thatonNavigateis a stable callback. - Documented why
disabledIndicesis intentionally omitted for initial focusing (regression guard for #2604). - Switched focus-restoration logic to resolve
ownerDocumentfrom the reference element and updated effect dependencies.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d6231c9 to
a02c8ed
Compare
Remove the vestigial previousOnNavigateRef (onNavigate is a stable callback, so it always stored the same reference) and the stale comment describing the removed conditional-onNavigate behavior. Resolve the owner document from the in-DOM domReferenceElement instead of the provably-null floatingElement (realm-safe). Document the deliberate disabledIndices omission in initial focus (regression guard for mui#2604).
a02c8ed to
c7425d6
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
Small cleanup in
useListNavigation:previousOnNavigateRef—onNavigateis a stable callback, so it always stored the same reference; drop the ref, its assignment, and the stale comment describing the removed conditional-onNavigatebehavior.domReferenceElementinstead of the provably-nullfloatingElement(realm-safe for shadow DOM / iframes); add the effect dependency.disabledIndicesomission at initial focus (regression guard for [useListNavigation] Ignore disabled item on initial focusing #2604) so it no longer reads like a bug.The
useListNavigationsuite passes; typecheck/eslint clean. Based on currentmaster.