Skip to content

[accordion] Proposal: align Accordion keyboard navigation with APG - #4965

Merged
atomiks merged 7 commits into
mui:masterfrom
chuganzy:accordion-composition
Jun 8, 2026
Merged

atomiks merged 7 commits into
mui:masterfrom
chuganzy:accordion-composition

Conversation

@chuganzy

@chuganzy chuganzy commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

The Accordion APG pattern no longer recommends roving focus, as documented in w3c/aria-practices#3434.

This PR proposes removing roving focus from Accordion to align with the latest APG guidance.

@pkg-pr-new

pkg-pr-new Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@4965
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4965
    

commit: 55add76

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-857B(-0.18%) ▼-234B(-0.16%)

Details of bundle changes

Performance

Total duration: 1,110.68 ms ▼-528.79 ms(-32.3%) | Renders: 50 (+0) | Paint: 1,672.31 ms ▼-786.04 ms(-32.0%)

Test Duration Renders
Tabs mount (200 instances) 214.65 ms ▼-96.80 ms(-31.1%) 4 (+0)
Select mount (200 instances) 123.55 ms ▼-79.29 ms(-39.1%) 3 (+0)
Slider mount (300 instances) 144.50 ms ▼-76.96 ms(-34.8%) 3 (+0)
Scroll Area mount (300 instances) 82.85 ms ▼-50.80 ms(-38.0%) 3 (+0)
Checkbox mount (500 instances) 58.65 ms ▼-43.69 ms(-42.7%) 1 (+0)

…and 6 more (+1 within noise) — details


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

@netlify

netlify Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 55add76
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a264b05f1b373000808e565
😎 Deploy Preview https://deploy-preview-4965--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.

@chuganzy
chuganzy force-pushed the accordion-composition branch from 484bc35 to 51d0666 Compare June 3, 2026 09:34
@aarongarciah aarongarciah added component: accordion Changes related to the accordion component. accessibility a11y labels Jun 3, 2026
@atomiks

atomiks commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Probably more accurate: "@deprecated Roving focus was removed from Accordion following the APG guidance update"

Not sure if props becoming no-ops is confusing but given the guidelines update and deletion of a bunch of code, I'm okay with this as it's not critical behavior.

According to Codex:

  • Arrow keys conflicted with normal page scrolling. The original W3C issue says Up/Down moved focus between accordion headers, so the user could no longer scroll the page to read opened accordion content. (github.com)
  • APG concluded accordion is not really a composite widget like menu/listbox/tabs/grid. It’s “a collection of independent headings,” closer to disclosure sections, so composite roving-focus navigation was considered contrived. (w3.org) (Arguably, this is also the case for Navigation Menu)
  • The shortcuts had poor discoverability: there’s no native/browser precedent or role="accordion" signal that would tell users arrow/Home/End are available. (w3.org) Current APG keyboard guidance now only lists Enter/Space and Tab/Shift+Tab for accordion headers. (w3.org)

@colmtuite

Copy link
Copy Markdown
Contributor

I'm fine with this 👍

@chuganzy
chuganzy force-pushed the accordion-composition branch from 31bbc6f to 4c15039 Compare June 7, 2026 05:03
Comment on lines +690 to +691
* Deprecated following the [APG guidance update](https://github.com/w3c/aria-practices/pull/3434)
* to remove roving focus.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@deprecated doesn't show up in the docs so added it to the main text. Given it's a no-op now it makes sense to remove the original description as it's otherwise misleading

@chuganzy chuganzy Jun 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was originally thinking to improve the docgen separately to check @deprecated, but this change makes more sense. Thank you for the update.

@atomiks
atomiks merged commit be47a62 into mui:master Jun 8, 2026
6 checks passed
@chuganzy
chuganzy deleted the accordion-composition branch June 8, 2026 05:08
@chuganzy chuganzy mentioned this pull request Jun 8, 2026
1 task done
adamfratino added a commit to uiid-systems/design-system that referenced this pull request Aug 20, 2026
Five minor releases (1.3.0 -> 1.7.0, Feb to Aug 2026) across the 27
@base-ui/react modules this repo uses.

Of the three breaking changes declared upstream, only one reaches us:
`Drawer` was unmarked as preview in 1.3.0, renaming the namespace export
`DrawerPreview` -> `Drawer`. 1.7.0 ships no deprecated alias, so the rename is
mandatory — the 11 imports under packages/overlays/src/drawer/subcomponents all
alias to `BaseDrawer`, so only the import specifier changes. The other two
(`sanitizeValue()` -> `normalizeValue()`, `OTPFieldPreview` -> `OTPField`) touch
APIs this repo does not use.

Two undeclared behaviour changes did reach our tests:

- Accordion lost roving focus in 1.6.0 (mui/base-ui#4965), following the APG
  which no longer recommends it (w3c/aria-practices#3434). Arrow keys no longer
  move focus between triggers; Tab does. The test now covers both.
- 1.7.0 appends an invisible Word Joiner (U+2060) to Combobox/Autocomplete empty
  state text for ~200ms so Safari VoiceOver announces the polite live region.
  Exact-string matching broke on the marker; the assertion now matches loosely.

Neither is a defect in this repo — both are upstream corrections our tests were
pinning to the old behaviour.

Verified: 481 tests pass, 17/17 build tasks including docs prerender, all size
budgets green (aggregate 291.27 -> 295.71 kB), format and lint clean. The
externalization from #305 still holds — no base-ui bundled in any dist.

BREAKING CHANGE: the @base-ui/react peer range moves from ^1.2.0 to ^1.7.0.
Consumers on 1.2.x-1.6.x must upgrade. Accordion triggers are no longer a roving
focus group — arrow keys no longer move focus between them, per current APG
guidance.

Closes #303
nicu-chiciuc added a commit to samebase/samebase that referenced this pull request Oct 24, 2026
* Update the public sidebar baseline for the centered GitHub button

PR #1758 (v2142) centered the OAuth buttons so the local password form appears
below them without moving them, and updated the MCP consent snapshot. The public
legal route sidebar snapshot still showed the left-aligned button, so main CI
failed on it with a 0.04 pixel ratio. The new Linux baseline matches the image
the main CI runner rendered pixel for pixel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Move between landing FAQ questions with Tab

PR #1755 (v2139) updated @base-ui/react from 1.4.1 to 1.9.0. Base UI 1.6.0
removed arrow-key focus movement between accordion triggers, following the
current APG accordion pattern (mui/base-ui#4965), so ArrowDown no longer moves
focus to the next question. Each trigger stays in the tab order, so the test
now presses Tab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Wait for the trailing-newline diff fixture before counting

The test counted the fixture URL once right after networkidle, with no wait.
The client-only visual fixture route shows its pending screen first, and
TanStack Router keeps a shown pending screen for its 500 ms
defaultPendingMinMs, so the fixture mounts after networkidle and the count was
0. With pendingMinMs 0 the fixture mounted before networkidle. The test now
waits for the URL text to be visible, like the test above it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y component: accordion Changes related to the accordion component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants