aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Tooltip/tooltip.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Tooltip/tooltip.ts b/src/lib/Tooltip/tooltip.ts
index ca3c3570..7c8099e6 100644
--- a/src/lib/Tooltip/tooltip.ts
+++ b/src/lib/Tooltip/tooltip.ts
@@ -6,6 +6,7 @@ const tooltip = (element: HTMLElement) => {
const debounceDelay = 100;
let hideTimeout: number | null = null;
let debounceTimer: number | null = null;
+ let visible = false;
const createTooltip = () => {
if (!tooltipDiv) {
@@ -54,12 +55,17 @@ const tooltip = (element: HTMLElement) => {
updateTooltipPosition(x, y);
setTimeout(() => {
- if (tooltipDiv) tooltipDiv.style.opacity = '1';
+ if (tooltipDiv) {
+ visible = true;
+ tooltipDiv.style.opacity = '1';
+ }
}, 10);
}
};
const hideTooltip = () => {
+ if (!visible) return;
+
hideTimeout = window.setTimeout(() => {
if (tooltipDiv) {
tooltipDiv.style.opacity = '0';
@@ -67,7 +73,9 @@ const tooltip = (element: HTMLElement) => {
setTimeout(() => {
if (tooltipDiv) {
document.body.removeChild(tooltipDiv);
+
tooltipDiv = null;
+ visible = false;
}
}, tooltipTransitionTime);
}