hide related tooltip on element removal

This commit is contained in:
Gani Georgiev
2026-06-12 12:31:43 +03:00
parent 01dcb5aaf3
commit 2e9cc27fc8
7 changed files with 14 additions and 8 deletions
+7 -1
View File
@@ -8,6 +8,8 @@ const tooltip = t.div({
document.body.appendChild(tooltip);
function updateTooltipPosition(node, position, styleClass) {
tooltip._relatedNode = node;
let nodeRect = node.getBoundingClientRect();
tooltip.setAttribute("data-style", styleClass || "");
@@ -74,6 +76,7 @@ function updateTooltipPosition(node, position, styleClass) {
}
function hideTooltip() {
tooltip._relatedNode = null;
tooltip.hidePopover();
}
@@ -126,8 +129,11 @@ function tooltipAction(textOrFunc, position = "top", styleClass = "") {
const originalOnunmount = el.onunmount;
el.onunmount = (el) => {
tooltipTextWatcher?.unwatch();
if (tooltip._relatedNode == el) {
hideTooltip();
}
tooltipTextWatcher?.unwatch();
el._tooltipText = null;
el?.removeEventListener("mouseenter", showEventHandler);