Skip to content

[composite] Clean up useListNavigation#5028

Open
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:claude/composite-uselistnavigation-cleanup
Open

[composite] Clean up useListNavigation#5028
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:claude/composite-uselistnavigation-cleanup

Conversation

@atomiks

@atomiks atomiks commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Small cleanup in useListNavigation:

  • Remove the vestigial previousOnNavigateRefonNavigate is a stable callback, so it always stored the same reference; drop the ref, its assignment, 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 for shadow DOM / iframes); add the effect dependency.
  • Document the deliberate disabledIndices omission at initial focus (regression guard for [useListNavigation] Ignore disabled item on initial focusing #2604) so it no longer reads like a bug.

The useListNavigation suite passes; typecheck/eslint clean. Based on current master.

@atomiks atomiks added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. component: composite labels Jun 12, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown

commit: c7425d6

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 12, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-19B(0.00%) ▼-11B(-0.01%)

Details of bundle changes

Performance

Total duration: 1,035.48 ms ▼-418.76 ms(-28.8%) | Renders: 50 (+0) | Paint: 1,550.23 ms ▼-634.15 ms(-29.0%)

Test Duration Renders
Tabs mount (200 instances) 205.64 ms ▼-65.80 ms(-24.2%) 4 (+0)
Select mount (200 instances) 117.63 ms ▼-56.89 ms(-32.6%) 3 (+0)
Checkbox mount (500 instances) 62.94 ms ▼-51.16 ms(-44.8%) 1 (+0)
Slider mount (300 instances) 150.06 ms ▼-44.94 ms(-23.0%) 3 (+0)
Menu mount (300 instances) 117.61 ms ▼-38.38 ms(-24.6%) 2 (+0)

…and 7 more — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c7425d6
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a2ba9fe98a4ad000870fd3e
😎 Deploy Preview https://deploy-preview-5028--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks requested a review from Copilot June 12, 2026 06:22
@atomiks atomiks marked this pull request as ready for review June 12, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 previousOnNavigateRef usage now that onNavigate is a stable callback.
  • Documented why disabledIndices is intentionally omitted for initial focusing (regression guard for #2604).
  • Switched focus-restoration logic to resolve ownerDocument from the reference element and updated effect dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/react/src/floating-ui-react/hooks/useListNavigation.ts Outdated
Comment thread packages/react/src/floating-ui-react/hooks/useListNavigation.ts Outdated
@atomiks atomiks force-pushed the claude/composite-uselistnavigation-cleanup branch from d6231c9 to a02c8ed Compare June 12, 2026 06:32
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).
@atomiks atomiks force-pushed the claude/composite-uselistnavigation-cleanup branch from a02c8ed to c7425d6 Compare June 12, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: composite type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants