Remove tooltip if target element was replaced
Closed this issue · 0 comments
edloidas commented
When we click the element with tooltip, we add a timeout to remove it. We check pick the event's target
or currentTarget
to check if it's the same lastTarget
(of the tooltip). If the element with tooltip was clicked, we remove the tooltip.
In some cases, we might change the inner content of the element (e.g. replace the svg icon in the button). Thus, checking if last tooltip target equals or contains the target
is not enough, we must also check the currentTarget
: target
may change, but the element still exists.