Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle Group should have radiogroup role #3188

Open
akselinurmio opened this issue Oct 22, 2024 · 0 comments · May be fixed by #3189
Open

Toggle Group should have radiogroup role #3188

akselinurmio opened this issue Oct 22, 2024 · 0 comments · May be fixed by #3189

Comments

@akselinurmio
Copy link

Bug report

Toggle Group component incorrectly uses attribute role="group" for grouping the item elements, which have attribute role="radio". ARIA spec states that radio buttons should be grouped within an element with role="radiogroup" attribute.

Current Behavior

<ToggleGroup.Root type="single"> exposes a role "group".

VoiceOver on Mac reads the Root element as "group". VoiceOver doesn't read any positions or total amount of items at the Item elements.

Expected behavior

<ToggleGroup.Root type="single"> exposes a role "radiogroup".

VoiceOver on Mac provides additional information for the user: Root reads out as "radio group" and Item elements have positions and total amount of radio buttons read out, for example "1 of 2" for the first first button when there are two items in total.

Reproducible example

CodeSandbox

Suggested solution

Change the role attribute value of the ToggleGroup.Root to "radiogroup" when the ToggleGroup.Item has a role "radio".

Additional context

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-toggle-group 1.1.0 (latest)
React n/a 17.0.1
Browser Safari 17.5
Assistive tech VoiceOver n/a
Node n/a
npm/yarn npm
Operating System macOS 14.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant