atomiks / tippyjs

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

add Property getNestedPopperElements #1151

Open mwoess opened 7 months ago

mwoess commented 7 months ago

I use tippy.js within the shadow dom of a custom element and need the callback to detect nested instances of tippy.

Example

const instance = tippy(element, {
  // ...
  getNestedPopperElements: (): PopperElement[] => {
    return Array.from<TooltipComponent>(this.querySelectorAll('my-tooltip') || [])
      .map<PopperElement>(tooltip => tooltip.renderRoot.querySelector('[data-tippy-root]') as PopperElement)
      .filter(element => !!element);
    },
});