Skip to content

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

Open
@SuiteMel

Description

@SuiteMel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions