Skip to content

[combo-box] Fix applying data-readOnly for ComboboxTrigger - #5418

Open
sai6855 wants to merge 3 commits into
mui:masterfrom
sai6855:data-read-combobo
Open

[combo-box] Fix applying data-readOnly for ComboboxTrigger#5418
sai6855 wants to merge 3 commits into
mui:masterfrom
sai6855:data-read-combobo

Conversation

@sai6855

@sai6855 sai6855 commented Aug 5, 2026

Copy link
Copy Markdown
Member

readOnly was missing from the trigger's state, so the documented data-readonly style hook never rendered, even though the sibling Combobox.Input already emits it. Added readOnly to the state plus a test.


const state: ComboboxTriggerState = {
...fieldState,
readOnly,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

data-readOnly wasn't added when root was set to readOnly. adding readOnly state here fixed the issue

@sai6855 sai6855 added type: bug It doesn't behave as expected. component: combobox Changes related to the combobox component. labels Aug 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

commit: e246e74

@code-infra-dashboard

code-infra-dashboard Bot commented Aug 5, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+11B(0.00%) 🔺+3B(0.00%)

Details of bundle changes

Performance

Total duration: 1,249.57 ms -13.19 ms(-1.0%) | Renders: 78 (+0) | Paint: 1,980.78 ms +1.03 ms(+0.1%)

Test Duration Renders
Mixed surface mount (app-like density) 88.74 ms 🔺+24.16 ms(+37.4%) 5 (+0)

14 tests within noise — details

Metric alarms

Test Metric Change
Mixed surface mount (app-like density) bench:paint 🔺 +35.39 ms

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

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Built without sensitive environment variables

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

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

This PR fixes the Combobox.Trigger state so the readOnly flag is reflected in its state-driven data attributes (enabling the data-readonly styling hook), aligning it with how other components expose readOnly for styling.

Changes:

  • Adds readOnly to ComboboxTrigger’s computed state so useRenderElement can apply data-readonly.
  • Extends ComboboxTriggerState with a readOnly field.
  • Adds a regression test asserting data-readonly is present only when readOnly is true.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/react/src/combobox/trigger/ComboboxTrigger.tsx Includes readOnly in the trigger state so the data-readonly style hook is applied correctly.
packages/react/src/combobox/trigger/ComboboxTrigger.test.tsx Adds coverage to ensure data-readonly toggles with the readOnly prop.

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

@sai6855
sai6855 marked this pull request as ready for review August 5, 2026 07:58
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. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants