-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[core] fix(Overlay): improve focus management #4963
Conversation
[core] fix(Overlay): improve focus managementPreviews: documentation | landing | table | modern colors demo |
remove reference to bug repro codePreviews: documentation | landing | table | modern colors demo |
There are issues with reverse TAB key navigation with this change. Here's an example where I press TAB x4 times and then SHIFT+TAB x4 times after clicking the button to open this dialog: When pressing SHIFT+TAB, we expect the focus to cycle back from the end of the dialog and up through the focusable elements. Instead, it appears that nothing happens and the focus stays on the end focus trap element. |
fix trap behavior, use regular react event handlersPreviews: documentation | landing | table | modern colors demo |
Things are better now, but there's still a minor issue where the second to last focusable element in the dialog seems to get focussed after pressing Shift+Tab at the end of the dialog. It's turning out to be a tricky one to fix... will probably just punt it for later, since this change seems like a strict improvement over the current state of things. |
tweak variable namePreviews: documentation | landing | table | modern colors demo |
Ok, I've now fixed the issue I mentioned in the previous comment. This should be good to go |
don't get trapped on start focus elementPreviews: documentation | landing | table | modern colors demo |
Fixes #4956, fixes #4920, and related issues
Checklist
Changes proposed in this pull request:
Adjust Overlay's focus management behavior to avoid programmatically focussing elements inside the overlay contents in most cases, opting for keeping focus on the start/end focus trap elements instead
Reviewers should focus on:
We should still get the accessibility enhancements added by #4894, but without the overly invasive focus management which caused issues like #4956.
Screenshot