w3c / aria-practices

WAI-ARIA Authoring Practices Guide (APG)
https://www.w3.org/wai/aria/apg/
Other
1.21k stars 344 forks source link

Seeking advice on what pattern to follow for a "ToggleGroup" #2579

Closed joshuawootonn closed 1 year ago

joshuawootonn commented 1 year ago

Hello there.

I am trying to understand what pattern I should follow for a "ToggleGroup" like these two examples:

CleanShot 2023-01-09 at 08 26 48@2x

Different UI kits (in react) follow different patterns.

Is the selection style arbitrary for this component?

If your toggle button is in a tool bar and changes text alignment it might be jarring to have the entire body of text change alignment over and over as you move through your toggle button.

But in the same vein, if you are filling in a google form with standard information for an event you are joining, you would probably expect this input to behave like a radio button.

Thinking about this: https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_selection_follows_focus

What pattern should this component follow?

Thanks 🙏🏼

JAWS-test commented 1 year ago

https://www.w3.org/WAI/ARIA/apg/example-index/toolbar/toolbar.html has also a

sortof a radio group pattern, but selection doesn't follow focus

joshuawootonn commented 1 year ago

Because ARIA is designed to inform assistive technologies about UI semantics and behaviors, not styling, the alignment toggles provide the following keyboard support described in the radio group design pattern.

This line was particularly clarifying for me. Thank you @JAWS-test