From 7d85de4d5c76760f3807c575966e79bc2fd192fe Mon Sep 17 00:00:00 2001 From: Aylam Date: Sat, 4 Nov 2023 17:23:03 +0200 Subject: [PATCH] Don't show tooltips when touch input is used --- packages/client/src/scripts/use-tooltip.ts | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/packages/client/src/scripts/use-tooltip.ts b/packages/client/src/scripts/use-tooltip.ts index a5e5ed7a2..9144bf325 100644 --- a/packages/client/src/scripts/use-tooltip.ts +++ b/packages/client/src/scripts/use-tooltip.ts @@ -7,11 +7,6 @@ export function useTooltip( ): void { let isHovering = false; - // iOS(Androidも?)では、要素をタップした直後に(おせっかいで)mouseoverイベントを発火させたりするため、それを無視するためのフラグ - // 無視しないと、画面に触れてないのにツールチップが出たりし、ユーザビリティが損なわれる - // TODO: 一度でもタップすると二度とマウスでツールチップ出せなくなるのをどうにかする 定期的にfalseに戻すとか...? - let shouldIgnoreMouseover = false; - let timeoutId: number; let changeShowingState: (() => void) | null; @@ -39,7 +34,6 @@ export function useTooltip( const onMouseover = () => { if (isHovering) return; - if (shouldIgnoreMouseover) return; isHovering = true; timeoutId = window.setTimeout(open, delay); }; @@ -51,20 +45,6 @@ export function useTooltip( close(); }; - const onTouchstart = () => { - shouldIgnoreMouseover = true; - if (isHovering) return; - isHovering = true; - timeoutId = window.setTimeout(open, delay); - }; - - const onTouchend = () => { - if (!isHovering) return; - isHovering = false; - window.clearTimeout(timeoutId); - close(); - }; - const stop = watch( elRef, () => { @@ -74,8 +54,6 @@ export function useTooltip( elRef.value instanceof Element ? elRef.value : elRef.value.$el; el.addEventListener("mouseover", onMouseover, { passive: true }); el.addEventListener("mouseleave", onMouseleave, { passive: true }); - el.addEventListener("touchstart", onTouchstart, { passive: true }); - el.addEventListener("touchend", onTouchend, { passive: true }); el.addEventListener("click", close, { passive: true }); } },