Skip to content

[combobox][autocomplete] Add aria-readonly to the listbox and the combobox trigger - #5541

Open
vikuscz wants to merge 1 commit into
mui:masterfrom
vikuscz:combobox-aria-readonly-listbox
Open

[combobox][autocomplete] Add aria-readonly to the listbox and the combobox trigger#5541
vikuscz wants to merge 1 commit into
mui:masterfrom
vikuscz:combobox-aria-readonly-listbox

Conversation

@vikuscz

@vikuscz vikuscz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #5531 / #5530. No behavior change — this only exposes the read-only state where it was missing.

#5531 added aria-readonly to Select's listbox. Combobox.List — which is also Autocomplete.List — renders role="listbox" (or role="grid"), both of which aria-readonly is defined for, and it carried no read-only state at all, so the two components were left inconsistent.

Changes

  • Combobox.List: aria-readonly when the root is readOnly. Covers Autocomplete.List too, since it's the same component.
  • Combobox.Trigger: aria-readonly, but only when it renders with role="combobox" (inputInsidePopup), mirroring how aria-required is already gated on the same condition. Without that role the trigger is a plain button, where the attribute wouldn't apply — that's what [combobox][autocomplete] Remove aria-readonly prop from Clear and Popup components when readOnly #3907 removed from Clear and Popup — and in that composition the Combobox.Input outside the popup already exposes aria-readonly.

Testing

Five tests: listbox with and without readOnly, the Autocomplete listbox, and the trigger in both compositions (asserting the plain-button one exposes nothing while its input does). Three of them fail without the source change.

pnpm test:chromium src/combobox src/autocomplete (1070 passed) and pnpm test:jsdom (1014 passed) are green, pnpm prettier and eslint on the changed files are clean. pnpm typescript currently fails on master for me in packages/react/test/floating-ui-tests/Popover.tsx (missing FloatingPortal/FloatingTree/useFloatingNodeId exports) — that reproduces on a clean checkout of 446df6e without my changes, so I've left it alone, but flagging it in case it isn't known.

…bobox trigger

Follow-up to mui#5531, which added `aria-readonly` to `Select`'s listbox. `Combobox.List`
(also `Autocomplete.List`) renders `role="listbox"` or `role="grid"`, both of which
`aria-readonly` is defined for, and it carried no read-only state at all.

`Combobox.Trigger` gets it only when it renders with `role="combobox"`, mirroring how
`aria-required` is already gated: without that role the trigger is a plain button, where
the attribute wouldn't apply (mui#3907), and the `Combobox.Input` outside the popup already
exposes the state.
@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

Copy link
Copy Markdown

commit: 64b5c66

@code-infra-dashboard

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+73B(+0.02%) 🔺+12B(+0.01%)

Details of bundle changes


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

@netlify

netlify Bot commented Aug 19, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Built without sensitive environment variables

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

@vikuscz

vikuscz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

The red Benchmark tests check is the same one I flagged on #5531, and since it has now happened on two separate PRs it doesn't look like flakiness: both times it failed in the Run baseline benchmarks at merge-base step — inside the /tmp/base-worktree checkout of master, before the head benchmarks ran — on tests/tooltip.bench.tsx:

AssertionError: Iteration 5 render events differ from iteration 0:
  expected [ 'bench:mount' ] to deeply equal [ 'bench:mount', 'bench:update', …(8) ]

Both runs also reported Tooltip mount (300 contained roots): 0.00ms (0 renders, 20 iterations) in the results summary, so that benchmark seems to capture nothing on master rather than measuring a regression. Jobs: 354337, 355277.

Nothing in this PR touches Tooltip, and it changes no behavior at all — just ARIA attributes.

@zannager zannager added the component: combobox Changes related to the combobox component. label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants