somewebmedia / hc-offcanvas-nav

JavaScript library for creating toggled off-canvas multi-level navigations, allowing endless nesting of submenu elements, supporting swipe gestures, keyboard interactions and ARIA attributes.
https://somewebmedia.github.io/hc-offcanvas-nav/
MIT License
336 stars 82 forks source link

trapFocus ignored & failed removeEventListener by closing with Esc key #52

Closed 5ulo closed 3 years ago

5ulo commented 3 years ago

Tested on your demo with FF and Chrome - after opening the navbar, items were not trapped. I remember trap focus was working in the past (I don't remember the version). With the latest 6.0.2 I'm free to jump between elements through the whole page. That should be limited only for the active level. For now I am using open and open.level events for custom tab-trap.

And also closing the navbar with Esc key causes error in the console Uncaught TypeError: Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only 1 present.

somewebmedia commented 3 years ago

Fixed with the latest version.

Be aware that FF for some reason doesn't follow the rules on element focusing, and focuses only form elements (you can check this with any web page).