Skip to content

Conversation

@markocupic024
Copy link
Contributor

@markocupic024 markocupic024 commented Jan 31, 2026

Closes #3906

readOnly has no effect these buttons

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 31, 2026

commit: aff0bb1

@mui-bot
Copy link

mui-bot commented Jan 31, 2026

Bundle size report

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

Details of bundle changes


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

@netlify
Copy link

netlify bot commented Jan 31, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit aff0bb1
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/697fe974ae7e540008ebf148
😎 Deploy Preview https://deploy-preview-3907--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 31, 2026

Greptile Overview

Greptile Summary

Removed aria-readonly attribute from ComboboxClear and ComboboxTrigger button components. According to ARIA specifications, the aria-readonly attribute is only valid for input-type roles (like textbox, checkbox, radio), not for button elements. Since these components render as buttons and already prevent interactions through their onClick handlers when readOnly is true, the aria-readonly attribute has no semantic effect and should be removed.

Key changes:

  • Removed aria-readonly from ComboboxClear component
  • Removed aria-readonly from ComboboxTrigger component
  • Updated all related tests to reflect these changes
  • Behavior remains unchanged - buttons still correctly ignore clicks when readOnly is true

Note: The ComboboxChipRemove component (also a button) still has aria-readonly and should be updated for consistency in a follow-up.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes correctly remove an invalid ARIA attribute from button elements. The actual readonly behavior is preserved through event handler checks, and all tests have been properly updated. No functional changes to the component behavior.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/combobox/clear/ComboboxClear.tsx Removed aria-readonly attribute from the Clear button component
packages/react/src/combobox/trigger/ComboboxTrigger.tsx Removed aria-readonly attribute from the Trigger button component

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@@ -90,7 +90,6 @@ export const ComboboxClear = React.forwardRef(function ComboboxClear(
{
tabIndex: -1,
children: 'x',
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with this change, consider also removing aria-readonly from ComboboxChipRemove component (line 57 in packages/react/src/combobox/chip-remove/ComboboxChipRemove.tsx) and updating its tests. The ComboboxChipRemove component is also a button that should not have aria-readonly for the same reasons as Clear and Trigger buttons.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react/src/combobox/clear/ComboboxClear.tsx
Line: 92:92

Comment:
For consistency with this change, consider also removing `aria-readonly` from `ComboboxChipRemove` component (line 57 in `packages/react/src/combobox/chip-remove/ComboboxChipRemove.tsx`) and updating its tests. The `ComboboxChipRemove` component is also a button that should not have `aria-readonly` for the same reasons as Clear and Trigger buttons.

How can I resolve this? If you propose a fix, please make it concise.

@atomiks atomiks added component: autocomplete Changes related to the autocomplete component. component: combobox Changes related to the combobox component. labels Feb 1, 2026
@atomiks
Copy link
Contributor

atomiks commented Feb 1, 2026

Failing test:

FAIL @base-ui/react src/combobox/root/ComboboxRoot.test.tsx > <Combobox.Root /> > selection behavior > multiple > should handle readOnly state with chips

@atomiks
Copy link
Contributor

atomiks commented Feb 2, 2026

Thanks for the fix @markocupic024!

@atomiks atomiks merged commit 2560b5a into mui:master Feb 2, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: autocomplete Changes related to the autocomplete component. component: combobox Changes related to the combobox component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[combobox][autocomplete] aria-readonly on Clear and Popup components when readOnly

3 participants