-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(dropdown): container body keyboard navigation #3791
fix(dropdown): container body keyboard navigation #3791
Conversation
ae9c8d5
to
bc04267
Compare
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.
Hey, @benouat, LGTM!
Just have:
- a short question about
tabindex
- a short request to refactor accessing to
anchorEl
viagetNativeElement()
Haven't checked the test coverage on my side.
Cheers,
Max
bc04267
to
6fda4bc
Compare
I created a new commit regarding the refactoring of how to access |
accross anchor/toggle and menu
6fda4bc
to
567ec09
Compare
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.
Hey, @benouat, LGTM!
Just a small detail → I guess the second commit should be refactor
, not fix
, but I'm not sure if you want to squash them in the end or not.
Cheers,
Max
I'll squash it! |
Dropdown keyboard navigation is now fully supporting the "container="body" mode. Navigating a page with dropdowns using `Tab` does not break anymore, and follow the visual order of elements.
This PR is a follow up PR to #3625 which introduced the ability to close the dropdown when leaving it by the last elements.
Unfortunately, it did not fix the keyboard navigation when using
container="body"
is used.Leaving the dropdown menu from the bottom when container is set to "body" leaves the user in a broken state, where the browser window url bar gets the focus.
The PR introduces a mechanism to catch the last Tab from the dropdown menu, and temporary set the focus back in a synchronous fashion to the dropdown anchor, hence letting the browser placing the focus on the next focusable element.
It also makes sure now that whenever the user wants to close the dropdown from the keyboard with Esc, the focus gets back to the dropdown toggle element.
This used to be the broken behaviour that now works