Skip to content

fix(Tabs, Accordion): ignore nested root triggers in keyboard navigation - #2190

Merged
huntabyte merged 2 commits into
huntabyte:mainfrom
nureddinhaji:fix/nested-roving-focus
Oct 20, 2026
Merged

huntabyte merged 2 commits into
huntabyte:mainfrom
nureddinhaji:fix/nested-roving-focus

Conversation

@nureddinhaji

Copy link
Copy Markdown

Closes #2189

RovingFocusGroup collects candidates with querySelectorAll, which also matches the triggers of a nested Tabs.Root or Accordion.Root. So End and arrow-key wrapping on the outer list jump into the nested one, or do nothing when it sits in a hidden panel.

Changes

  • Add an optional rootAttr to RovingFocusGroup. When set, only candidates whose closest [rootAttr] ancestor is the group's own root are kept.
  • Tabs and Accordion pass their root attribute. Other components are unchanged.

Tests

Added a nested-root test for Tabs and for Accordion. Both fail on main and pass with this change, and the full browser suite passes in Chromium.

ToggleGroup, RadioGroup, Toolbar and the other roving-focus components could opt in the same way in a follow-up.

@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24be777

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bits-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview 5e4f263

@huntabyte
huntabyte merged commit 9a0693b into huntabyte:main Oct 20, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026

This branch was successfully deployed

1 active deployment
Preview — 24be7772 Deployed Oct 20, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs / Accordion: keyboard navigation of the outer root picks up the triggers of a nested root

2 participants