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

Improve withConstrainedTabbing to take into account click on the content #10165

Closed
afercia opened this issue Sep 25, 2018 · 0 comments
Closed
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Comments

@afercia
Copy link
Contributor

afercia commented Sep 25, 2018

Splitting this out from #9973

While testing the Modal component, an edge case surfaced which should be taken into account by withConstrainedTabbing. To reproduce:

  • test with Safari, Edge, or IE 11 where this edge case is more evident
  • open the Help modal (on a mac, press Control-Option-H, on Windows: Shift-Alt-H)
  • press Tab and verify focus stays on the Close button
  • click in the middle of the content
  • press Tab
  • instead of staying within the modal, focus is now on the document root

Testing the modal, it was pointed out that adding a tabIndex="-1" to the modal wrapper could help. It does help but if still fails on Safari, Edge, and IE11. Instead of relying on browsers implementation of focus and tab starting point, a better option would trying to address this issue programmatically.

Proposed solution

  • add a tabIndex="-1" to the withConstrainedTabbing wrapper instead of to the single component wrapped in withConstrainedTabbing
  • account for the case when the keydown event target is the wrapper itself, which happens when clicking in the content and then pressing the Tab key
  • in this case, move focus to the first tabbable element
@afercia afercia added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

No branches or pull requests

1 participant