css-toggles icon indicating copy to clipboard operation
css-toggles copied to clipboard

Named state example

Open scottaohara opened this issue 3 years ago • 1 comments

This example doesn't communicate the currently chosen color option. And using aria-pressed on the button here wouldn't necessarily be the right choice, as that alone would indicate that the choice can be toggled on or off. However, here the choice can only be turned on, and by doing so it turns off the previously chosen choice.

A pattern like this might be better exposed as either a series of radios, possibly a menubar > menuitemradio, or continue to use buttons but ensure that it's clear that a second activation won't undo the toggle. aria-current=true might be a better choice for this as it represents the current choice without suggesting that the button should behave as a toggle. Otherwise, people have also used aria-pressed but also implemented aria-disabled to indicate that the button cannot be 'unpressed'.

These sorts of subtleties don't seem like they are possible via the current draft/explainer? Maybe I'm missing something.

scottaohara avatar May 07 '22 21:05 scottaohara

Agree, the draft will need to consider use cases like this more carefully

jerivas avatar May 12 '22 18:05 jerivas