atomiks / tippyjs

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

Wrong instance.reference value when using delegate #1014

Closed guivr closed 2 years ago

guivr commented 2 years ago

Bug description

When you use .delegate, the value of instance.reference in the event onMount is always the last reference created/opened - not the same as event.target value on onTrigger.

On my code, I can't use onTrigger, I need to use onMount, but onMount doesn't receive event info. How can I pass this info from onTrigger to onMount or is this a bug and instance.reference should actually be the event.target?

atomiks commented 2 years ago

Sounds like a bug, but you could store the variable somewhere, like on the instance itself instance._ref = ... inside onTrigger, then access that inside onMount

guivr commented 2 years ago

Very sorry for the inconvenience. Bug on my code, not yours