question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Tippy in shadow DOM

See original GitHub issue

https://codepen.io/anon/pen/ErExqd

Since scripts can access my shadow DOM but styles can’t, I tried to inline the Tippy CSS within the shadow DOM and link Popper’s and Tippy’s JS outside. I need the CSS to be scoped so I have the following constraint:

<style>
    :host {
      all: initial; /* 1st rule so subsequent properties are reset. */
      display: block;
      contain: content; /* Boom. CSS containment FTW. */
      /* any other CSS, so this is where I inlined the Tippy's */
    }
</style>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
skrivanoscommented, Mar 22, 2019

@atomiks Just had an issue implementing a custom element for Tippy in a Polymer 3 project (using ShadowDOM). Turns out the error lies here. Hacking it by setting isVirtual to true on the target element works, but I’m not sure if this has any other side effects. Please consider allowing us to either disable the auto-destroy or specify a different root element to search in.

0reactions
atomikscommented, Mar 22, 2019

The next statement also seems fishy to me, since I can see plenty of cases where you do want a tooltip for disabled elements. For instance to show a “You need Premium to click this”-text. But I’ll create a separate issue for that.

This statement is because different browsers handle disabled elements differently. In Firefox I think it works, but not Chrome. So standardizing disabling it makes sense. It’s recommended to use a wrapper node instead.

Edit: you may want to log a warning in those cases informing them of the potential memory leak?

I kind of want to overhaul the setup to allow for DEV-only warnings, and a development build. Like React. That way the production/minified version doesn’t have any warnings. There are tons of places I’d like to add some warnings but didn’t because I didn’t want to bloat the bundle size

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use Tippy in shadow DOM with scoped CSS?
Show activity on this post. I want to use Tippy. js in my shadow DOM. Since scripts can access my shadow DOM but...
Read more >
All Props | Tippy.js - GitHub Pages
Prop Default Description plugins Specify plugins to use. See Plugins for details. role "tooltip" Specifies the role attribute on the tippy element. zIndex 9999 Determines the...
Read more >
query-selector-shadow-dom - npm
Start using query-selector-shadow-dom in your project by running `npm i query-selector-shadow-dom`. There are 23 other projects in the npm ...
Read more >
Reporters | Vanilla JS (Custom element) - Felte
Felte offers an easy plugin-like way of reporting your errors by using what we ... to be either on the light DOM, or...
Read more >
Tooltip-Arrow with drop shadow - CodePen
All packages are different, so refer to their docs for how they work. If you're using React / ReactDOM, make sure to turn...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found