Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix not working interactive option #913

Merged
merged 1 commit into from
Mar 1, 2021
Merged

Conversation

zhaoyao91
Copy link
Contributor

@zhaoyao91 zhaoyao91 commented Mar 1, 2021

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

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
Copy link
Owner

atomiks commented Mar 1, 2021

Thank you!

@atomiks atomiks merged commit 3fe61fc into atomiks:master Mar 1, 2021
@zhaoyao91 zhaoyao91 deleted the patch-3 branch March 1, 2021 12:32
zhaoyao91 added a commit to zhaoyao91/tippyjs that referenced this pull request Mar 2, 2021
the following fix of atomiks#913

in `onDocumentPress`, the check for `event.target` should all be replaced with `actualTarget`.
@zhaoyao91 zhaoyao91 mentioned this pull request Mar 2, 2021
atomiks pushed a commit that referenced this pull request Mar 2, 2021
the following fix of #913

in `onDocumentPress`, the check for `event.target` should all be replaced with `actualTarget`.
junglerot pushed a commit to junglerot/jungle that referenced this pull request Feb 3, 2024
the following fix of atomiks/tippyjs#913

in `onDocumentPress`, the check for `event.target` should all be replaced with `actualTarget`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants