[combo-box] Fix applying data-readOnly for ComboboxTrigger - #5418
[combo-box] Fix applying data-readOnly for ComboboxTrigger#5418sai6855 wants to merge 3 commits into
data-readOnly for ComboboxTrigger#5418Conversation
|
|
||
| const state: ComboboxTriggerState = { | ||
| ...fieldState, | ||
| readOnly, |
There was a problem hiding this comment.
data-readOnly wasn't added when root was set to readOnly. adding readOnly state here fixed the issue
commit: |
Bundle size
PerformanceTotal duration: 1,249.57 ms -13.19 ms(-1.0%) | Renders: 78 (+0) | Paint: 1,980.78 ms +1.03 ms(+0.1%)
14 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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
readOnlytoComboboxTrigger’s computedstatesouseRenderElementcan applydata-readonly. - Extends
ComboboxTriggerStatewith areadOnlyfield. - Adds a regression test asserting
data-readonlyis present only whenreadOnlyis 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.
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.