mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
fix(tooltip): Sometimes tooltip flashes
This commit is contained in:
parent
5ce0383c03
commit
6d7abace97
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user