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

Radios in a set are all tabbable but only one at a time should be #28

Closed
davidtheclark opened this issue May 26, 2018 · 2 comments
Closed

Comments

@davidtheclark
Copy link
Collaborator

davidtheclark commented May 26, 2018

When you tab through a radio set (radio inputs sharing a name), only one of them is actually tabbable — one of the following:

  • The one that has been selected.
  • If none are selected and you're moving forward with tab, the first one.
  • If none are selected and you're moving backward with shift-tab, the last one.

This library doesn't take that into account: it treats radio inputs like other inputs, assuming they're all tabbable.

This would be a tricky problem to fix without adding a fair amount of delicate complexity. The best solution might be similar to the iframe problem: #23 (comment) — only hijack tab and shift+tab if you're leaving the focus trap. However, the big blocking failing of this solution remains to be solved: I think the approach will only work if the first and last tabbable elements in the container are recognizable by the library. For example, if the first element that's actually tabbable (according to the browser) is in an iframe or the shadow dom or is a selected radio button that's not the first one of it's group — then how is this library going to know that that's what should receive focus?

Open to solutions.

cc @doodirock

@doodirock
Copy link

Thanks for posting here @davidtheclark

Hopefully we can get a solve for ADA

@davidtheclark
Copy link
Collaborator Author

In 2.0 this is addressed by only including the checked radio in a radio group. The necessary caveat here is that you should have a checked radio.

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

No branches or pull requests

2 participants