atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
12.03k stars 520 forks source link

fix not working interactive option #913

Closed zhaoyao91 closed 3 years ago

zhaoyao91 commented 3 years ago

When tippy content is inside a shadow dom, the interactive option is not working.

The reason is

Events that happen in shadow DOM have the host element as the target, when caught outside of the component.

the popper is inside the host, so popper.contains(target) will always return false. see https://javascript.info/shadow-dom-events

by using event.composedPath instead of the event.target, it will get the actual target and fix this bug.

see https://stackoverflow.com/questions/39245488/event-path-is-undefined-running-in-firefox/39245638#39245638

atomiks commented 3 years ago

Thank you!