Skip to content

Build your personal knowledge base with Trilium Notes

fix(tooltip): Sometimes tooltip flashes

SiriusXT6d7abace97b7
diff --git a/apps/client/src/services/note_tooltip.ts b/apps/client/src/services/note_tooltip.ts
index 7227287337..8ea7ac88f2 100644
--- a/apps/client/src/services/note_tooltip.ts
+++ b/apps/client/src/services/note_tooltip.ts
@@ -10,6 +10,7 @@ import { t } from "./i18n.js";
// Track all elements that open tooltips
let openTooltipElements: JQuery<HTMLElement>[] = [];
+let dismissTimer: ReturnType<typeof setTimeout>;
function setupGlobalTooltip() {
$(document).on("mouseenter", "a", mouseEnterHandler);
@@ -26,6 +27,7 @@ function setupGlobalTooltip() {
}
function dismissAllTooltips() {
+ clearTimeout(dismissTimer);
openTooltipElements.forEach($el => {
$el.tooltip("dispose");
$el.removeAttr("aria-describedby");
@@ -129,11 +131,11 @@ async function mouseEnterHandler(this: HTMLElement) {
// cursor is neither over the link nor over the tooltip, user likely is not interested
dismissAllTooltips();
} else {
- setTimeout(checkTooltip, 1000);
+ dismissTimer = setTimeout(checkTooltip, 1000);
}
};
- setTimeout(checkTooltip, 1000);
+ dismissTimer = setTimeout(checkTooltip, 1000);
}
}