Repository navigation
[combo-box] Fix applying data-readOnly for ComboboxTrigger - #5418
Conversation
|
|
||
| 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,232.01 ms -78.91 ms(-6.0%) | Renders: 78 (+0) | Paint: 1,925.71 ms -116.82 ms(-5.7%)
13 tests within noise — details 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.
|
Ping @atomiks |
PR reviewOne merge-blocking public API mismatch remains. The runtime fix is mutation-proven and focused tests pass, but the shared Autocomplete alias was not updated. Bugs (1)1. 🔴 Keep the Autocomplete trigger state type in syncLocation: export const AutocompleteTrigger = ComboboxTrigger as AutocompleteTrigger;
export interface AutocompleteTriggerState extends FieldRootState {
// `readOnly` is missing
}
Failure scenario: A consumer styling Fix: Add VerdictRequest changes - the shared runtime component and its exported Autocomplete state contract are inconsistent. 🤖 Review generated with Codex |
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.