Merge branch 'develop' into tl-push

This commit is contained in:
syuilo
2023-10-03 15:33:33 +09:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ export function useTooltip(
let changeShowingState: (() => void) | null;
let autoHidingTimer;
const open = () => {
close();
if (!isHovering) return;
@@ -33,6 +35,16 @@ export function useTooltip(
changeShowingState = () => {
showing.value = false;
};
autoHidingTimer = window.setInterval(() => {
if (!document.body.contains(elRef.value)) {
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
close();
window.clearInterval(autoHidingTimer);
}
}, 1000);
};
const close = () => {
@@ -53,6 +65,7 @@ export function useTooltip(
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
window.clearInterval(autoHidingTimer);
close();
};
@@ -67,6 +80,7 @@ export function useTooltip(
if (!isHovering) return;
isHovering = false;
window.clearTimeout(timeoutId);
window.clearInterval(autoHidingTimer);
close();
};