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

Toggles that target elements with data-toggle-trigger-off in them hijack focus on data-toggle-escape/data-toggle-outside #123

Open
SuiteMel opened this issue Jan 6, 2023 · 0 comments

Comments

@SuiteMel
Copy link

SuiteMel commented Jan 6, 2023

Thank you for your response to my previous bug report, while I was working with the library some more I came across another data-toggle-trigger-off bug

Describe the bug
When an element receives a data-toggle-target that contains an element with data-toggle-trigger-off, and that toggle is opened and then escaped or closed via data-toggle-escape and/or data-toggle-outside. If focus had been moved to elsewhere on the page, the focus is moved back to the toggle element instead of remaining where it is on the page. This does not occur with elements that have a data-toggle-target without a data-toggle-trigger-off element in the target element

To Reproduce
https://codepen.io/suitemel/pen/JjBbWKW
Here is a codepen with the issue reproduced

Expected behavior
Focus shouldn't be moved back to the element once it's closed, focus should remain where it is

Desktop (please complete the following information):

  • OS: macOS Big Sur v 11.7.1
  • Browser: Chrome
  • Version 108.0.5359.124

Additional context
I've been using your library extensively for an ADA compliant site (data-toggle-trigger-off being used specifically for navigation menus) and due to this issue I've ran into I've had to create my own version of the data-toggle-trigger-off in my code to have the toggle get closed and avoid having focus get moved unnecessarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant