Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants