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

Editorial: note to expand radiogroup content 'allowances' #2159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scottaohara
Copy link
Member

@scottaohara scottaohara commented Apr 15, 2024

This PR attempts to close #1721

Per the discussion we had around the issue, the potential usability and wcag issues this could cause, there were few pros to relaxing how one could create a grouping of radio buttons. The issue of how would one name such a group if there is no actual "group" container to name was a very good point. Though HTML allows for such loose grouping of their radio buttons, they do not have a solution for all the potential a11y problems it can solve.

So, this PR takes a different approach to resolving the issue, and instead adds a note to clarify that a radiogroup does not have to be limited to just radio buttons, while ALSO pointing out the potential UX issues of adding other arbitrary/focusable elements.

Maybe something could even be added to overtly state that "hey if you want to group radio buttons like you can in HTML, then use HTML radio buttons!"

Happy to wordsmith this further (examples might be good?) Or entertain other solutions (we could close the issue as won't fix, but i recall being told we should do something rather than just that).

I created #2158 as a separate issue to resolve, since a lot of the conversation about this concept touched on the topic now logged in that issue. and I didn't want resolving this issue/pr to lose that separate though related topic.


Preview | Diff

This PR attempts to close #1721

Per the discussion we had around the issue, the potential usability and wcag issues this could cause, there were few pros to relaxing how one could create a grouping of radio buttons.  The issue of how would one name such a group if there is no actual "group" container to name was a very good point.  Though HTML allows for such loose grouping of their radio buttons, they do not have a solution for all the potential a11y problems it can solve.

So, this PR takes a different approach to resolving the issue, and instead adds a note to clarify that a radiogroup does not have to be limited to just radio buttons, while ALSO pointing out the potential UX issues of adding other arbitrary/focusable elements.

Maybe something could even be added to overtly state that "hey if you want to group radio buttons like you can in HTML, then use HTML radio buttons!"

Happy to wordsmith this further (examples might be good?)  Or entertain other solutions (we could close the issue as won't fix, but i recall being told we should do _something_ rather than just that).

I created #2158 as a separate issue to resolve, since a lot of the conversation about this concept touched on the topic now logged in that issue.  and I didn't want resolving this issue/pr to lose that separate though related topic.
that are enabled only when a specific radio button has been chosen (checked).</p>
<p>However, including non-radio button content into a <code>radiogroup</code> is not without its potential UX drawbacks. As it is generally expected
to use arrow keys to navigate between radio buttons, any non-radio button content could go unnoticed by some users, as arrowing through the radio buttons
would mean that any other tabbable elements (e.g., hyperlinks or other form fields) would be skipped. When creating a <code>radiogroup</code> with other
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is generally expected to use arrow keys to navigate between radio buttons, any non-radio button content could go unnoticed by some users, as arrowing through the radio buttons would mean that any other tabbable elements (e.g., hyperlinks or other form fields) would be skipped.

A couple questions/comments:

  • If interactive, non-radio button content (e.g., an additional field that appears on radio button selection) is also nested within the radiogroup, would this require extra work to keep track of focus? It sounds like this results in additional complexity for keyboard operability, i.e., when a radio button is focused, focus should move to the next tabbable element inside the radiogroup (if present) and not the next focusable element immediately after the radio group content
  • For additional non-radio content that appears on focus of a radio button, it sounds like this is OK provided the content appears after the current point of focus?
  • I'm also curious if this could break cardinality and AT reporting of how many items are in the radiogroup. Perhaps ATs can compensate for additional non-radio button content by adding the extra non-radio button stuff to ensure accurate setsize/posinset? I agree this should be discouraged for the reasons you've mentioned (and that it would be jarring for AT users to get kicked out of forms/focus mode when navigating non-interactive, non-radio button content)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quickly, but we can discuss more when we talk about this issue w/the group

  • for better/worse, i wouldn't expect any 'extra' keyboard focus work than what authors are doing now / how this would work if people used native HTML elements instead.
  • i think there could be additional author guidance for this pattern. apg might be better suited for that.
  • it shouldn't break anything? as far as i'm aware, radiogroups only provide setsize/posinset based on the radio buttons within, and don't include other items into the total count. If anything is doing otherwise, imo, that's a bug.

i made a quick demo in place of typing out many other words to describe current/expected behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider a mechanism to associate controls without an explicit grouping
3 participants