-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
Radio group should not listen to nested children under another radio group (aka: allow nesting) #2138
Comments
Testing it in VoiceOver + Safari, it reads as "1 of 5, 2 of 5" for the outer radios. And for the inner radios, it reads as "1 of 7", "2 of 7". So at the very least im not sure theres a way to implement this pattern in an accessible way 🤔 I'm also not sure if it has to do with the Do you have a real world example of what these forms would look like so we can have a better idea if this is something we want to support? |
Due to accessibility concerns, I don't think the current radio group component will work well here. @lindsaym-fa this might be a pattern we can consider supporting in Web Awesome, unless you have an alternative to suggest :) |
@claviska Agreed! Nesting radio components doesn't quite seem sound to me. But, in our quest for broader "choice group" capabilities, supporting radio behavior for the details component seems absolutely worthwhile. |
@lindsaym-fa I can't find any combo of aria roles to make this work. A native Let me do some research and checkout some prior art and issues to see if anyone else has filed anything around this. I'm hoping FormAssociated + ElementInternals can solve this, although to my knowledge hasn't been implemented by screen readers (yet) https://codepen.io/paramagicdev/pen/abgqKjz Here's a video of how nested radiogroups get read in VoiceOver (haven't tested NVDA yet) 2024-08-19.12-25-00.mp4 |
Also, assuming those radios live inside the |
So it appears its doable, perhaps with a little hackery we can emulate native radios 🤔 https://codepen.io/paramagicdev/pen/MWMQBdj Everyone except Safari supports it on VoiceOver. I'll have to check NVDA. |
Describe the bug
Hey!
I was trying to implement some kind of form with nested radio choices, with dynamic details depending on parent selection. However I noticed that you can't nest
sl-radio-group
without having their state "polluted" by inner most component.To make it clearer here are some screenshots:
First you select between A and B:
Then you need to select a refinement option between B1 and B2:
What's expected:
What happens:
Demo
https://jsfiddle.net/alex_bonaventu/3xokyn0g/3/
To me it would make sense that this component allow nesting to support these use-cases. Not sure if that violates some accessibility principles though....
Let me know if it makes sense to you as well, I can easily PR I think by filtering further radio components in that query:
https://github.com/shoelace-style/shoelace/blob/next/src/components/radio-group/radio-group.component.ts#L127
Thanks!
The text was updated successfully, but these errors were encountered: