-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix extra tab stop on Modal component #22063
Fix extra tab stop on Modal component #22063
Conversation
Size Change: -3.3 kB (0%) Total Size: 822 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this a test. I think the positive is that the dialog element is focused initially and the title of the modal is read in voiceover. The close button can now be tabbed to after initially opening the modal.
I think it might be a bit unexpected that there's an element that's focused initially which after tabbing is removed from the tab order, but it still seems to be a good improvement over how it works currently.
Description
Fixes #11631.
Currently, on VoiceOver with Safari, pressing arrow keys inside a modal will cause the modal to close, because focus is moved outside the modal. Changing the order of the HOCs wrappingModalFrame
so thatwithConstrainedTabbing
is inside ofwithFocusOutside
fixes the issue.Update: the fix for focus moving outside the modal on VoiceOver wasn't working properly so I'm focusing this PR on fixing the extra tab stop issue. Thanks @talldan for helping debug this 😄
This PR removes the
tabindex=0
fromcomponents-modal__content
and directs focus to land oncomponents-modal__frame
instead, as it already has atabindex=-1
and it is labelled by the modal header, so is more informative to screen readers. The element withtabindex=0
was causing an extra, unidentified tab stop between the last focusable element of the modal and the first, when tabbing through cyclically.How has this been tested?
Checked on Safari + VoiceOver on Mac, Firefox + NVDA on Windows, and checked just the keyboard interaction across several browsers.
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: