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

Focus trapping in Firefox + <sl-select> do not behave as expected #1809

Closed
KonnorRogers opened this issue Jan 9, 2024 · 0 comments · Fixed by #1813
Closed

Focus trapping in Firefox + <sl-select> do not behave as expected #1809

KonnorRogers opened this issue Jan 9, 2024 · 0 comments · Fixed by #1813
Labels
bug Things that aren't working right in the library.

Comments

@KonnorRogers
Copy link
Collaborator

Describe the bug

Found a super fun Firefox only "bug" with our focus trapping utility + <sl-select>.

When you go to tab into the buttons, you get stuck on the overflowing list, and then kicked out to the close button.

https://codepen.io/paramagicdev/pen/WNmxxQV

To Reproduce

1.) The currently focused element must be a<sl-select>
2.) the next element must be an element with overflow: auto / scroll
3.) you must be in firefox
4.) you must be inside of a <sl-dialog> or any other focus trapping container

Demo

https://codepen.io/paramagicdev/pen/WNmxxQV

Additional information

This happens because of a number of things:

Firefox has overflow: auto / scroll elements as scrollable. Our focus trapping utility doesn't account for that.
<sl-select> stops the focus trapping behavior of "Tab" by calling .stopPropagation()

event.stopPropagation();

@KonnorRogers KonnorRogers added the bug Things that aren't working right in the library. label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant