Support use in Shadow DOM
careless-esper opened this issue · comments
careless-esper commented
Bug Description
This plugin does not function properly when using with an instance of Embla Carousel contained in a Shadow DOM.
CodeSandbox
https://codesandbox.io/s/sleepy-wing-e8or8g
Steps to reproduce
- Open https://codesandbox.io/s/sleepy-wing-e8or8g
- Use mouse wheel to scroll through top carousel—carousel scrolls as expected
- Attempt to use mouse wheel to scroll through bottom carousel—carousel does not scroll properly
Suggested Fix
- In the createRelativeMouseEvent function, when creating the MouseEvent, add
composed: true
to the dictionary parameter (See https://developer.mozilla.org/en-US/docs/Web/API/Event/composed).
Felix Leupold commented
Thanks for opening the issue, providing a repro and suggesting even a fix. 🤟
I'll try to get this fix in later today/tomorrow.
Felix Leupold commented
@careless-esper Thanks again, for the perfect issue & repro.
I even stole your repro and added it to the demos, hope that's OK 😬
The fix is now available in newly published v2.1.1