swisspost / design-system

The Swiss Post Design System pattern library for a consistent and accessible user experience across the web platform.
https://design-system.post.ch
Apache License 2.0
106 stars 13 forks source link

Button group: check if we should use fieldset>legend instead of role="group" and aria-label #3023

Open gfellerph opened 2 weeks ago

gfellerph commented 2 weeks ago

image

In our examples, the label is not visible, but in a real world application, a button group should have a visible label. For this case, I think it would be better to use a fieldset / legend construct (https://www.w3.org/WAI/tutorials/forms/grouping/#associating-related-controls-with-wai-aria).

A breaking change can be prevented by supporting the current structure as well as the fieldset > legend one. Possibly, the current structure could be a variant where it's not possible or necessary to show the label.