RadioControl: allow individual options to be disabled - #82026
Conversation
|
Size Change: -398 B (-0.01%) Total Size: 7.91 MB 📦 View Changed
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 35f19ec. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/32863047742 Should insert content using the global inserter in |
| .components-radio-control__input:not(:disabled) { | ||
| & + .components-radio-control__label { | ||
| cursor: var(--wpds-cursor-control); | ||
| } | ||
| } |
There was a problem hiding this comment.
Should we bother nesting this?
| .components-radio-control__input:not(:disabled) { | |
| & + .components-radio-control__label { | |
| cursor: var(--wpds-cursor-control); | |
| } | |
| } | |
| .components-radio-control__input:not(:disabled) + .components-radio-control__label { | |
| cursor: var(--wpds-cursor-control); | |
| } |
There was a problem hiding this comment.
Alternatively, it likely could have been left where it was and replaced .components-radio-control:not(:disabled) with .components-radio-control__input:not(:disabled) + ?
There was a problem hiding this comment.
I like the last suggestion, I'll apply it and merge 🚀
b22788a to
35f19ec
Compare
Closes #81939
What?
Adds an optional
disabledfield to individualRadioControloptions. Unavailable choices can remain visible without disabling the whole radio group.Why?
Consumers currently have to hide the option, disable every choice, or recreate
RadioControlmarkup and depend on its internal class names.How?
The option's
disabledvalue is passed to its native radio input. This reuses the existing disabled indicator styles while keeping the label at its normal color and opacity, as shown in the design feedback.Testing Instructions
npm run storybook:dev.Testing Instructions for Keyboard
Screenshots
All options disabled (same as on trunk)
One option disabled, unselected
One option disabled, selected
Use of AI Tools
Codex was used to implement the change, run verification, and draft this description.