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

BS5 events not firing #71

Open 5ulo opened 3 years ago

5ulo commented 3 years ago

When hc-offcanvas-nav is included, I can't use BS5 eg. shown.bs.tab event. Check the codepen for example. I added console.log on shown.bs.tab event and it does nothing. When I completely remove hc-offcanvas-nav plugin, everything works fine.

https://codepen.io/5ulo/pen/mdEVbWY

5ulo commented 2 years ago

So the same is for any other events.. like show.bs.dropdown . The removeOriginalNav: true option doesn't help in this case. Any idea how to make those events working with hc-offcanvas-nav loaded?

mrjamesriley commented 2 years ago

Hello, the issue here is also impacting the Sauce (SNPT) plugin, even when simply including the hc-offcanvas-nav JS, without performing any instantiation. Specifically the issue kicks in for us when the hc-offcanvas-nav.helpers.js is included as a script tag.

It's hijacking the clicks for our plugin, seeming due to it overriding the Node.prototype.addEventListener in its addRemoveListener. I'm not familiar enough with HC offcanvas yet, but it seems like it can be conflict with many other plugins by modifying any use of e.g document.addEventListener.

sfritzsche commented 2 years ago

Same here on integrating into Magento 2. I agree with @mrjamesriley . The "EventListener" logic probably creates many problems.

somewebmedia commented 2 years ago

I'll have to re-write this or figure something else for capturing event listeners.

coweb01 commented 2 years ago

Hi, the issue also breaks bootstrap 5 modal events. hc-offcanvas is a very nice offcanvas menu and i would like to use it further. i have migrated my template to bootstrp 5. unfortunately it also partially destroys the bootstrap 5 events for me. does anyone have a workaround on how to get this running.