WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.16k stars 4.05k forks source link

CheckboxControl, RadioControl, ToggleControl: Support accessible, flexible layouts #60799

Open mirka opened 3 months ago

mirka commented 3 months ago

What problem does this address?

CheckboxControl, RadioControl, and ToggleControl do not properly support our layout needs, and developers are forced to roll their own solutions or override the component in fragile ways, which can result in slower iteration speeds and accessibility issues.

Examples of the problems we're encountering

CheckboxControl

RadioControl

ToggleControl

What is your proposed solution?

This can potentially be addressed in multiple ways, so we need to assess what is the best way forward. Possible approaches include:

ntsekouras commented 3 months ago

I'd avoid suggestion 1 and between the remaining two, I have a preference for suggestion 2. We've started doing it for more components and it's nice to have some a11y problems already solved by Ariakit.

mirka commented 3 months ago

I'd avoid suggestion 1

At least for CheckboxControl, the accessibility mishaps I've seen are mostly due to lack of awareness rather than deficiencies in component API, so we'd probably need to tackle the issue from the documentation angle as well, regardless of any improvements we can make to the actual API. I haven't looked too deeply into the RadioControl situation though.