From c9883f5eb4f340c70c03c4757c24ded4617bbc91 Mon Sep 17 00:00:00 2001 From: loucass003 Date: Thu, 11 Dec 2025 02:27:33 +0100 Subject: [PATCH] Fix mobile tooltip --- gui/src/components/commons/Tooltip.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gui/src/components/commons/Tooltip.tsx b/gui/src/components/commons/Tooltip.tsx index 18a95cfdd..b6b6615f3 100644 --- a/gui/src/components/commons/Tooltip.tsx +++ b/gui/src/components/commons/Tooltip.tsx @@ -359,13 +359,10 @@ export function DrawerTooltip({ } }; - const touchEnd = (e: MouseEvent | TouchEvent) => { - if (Date.now() - touchTimestamp.current > TOOLTIP_DELAY) { - // open drawer - e.preventDefault(); // cancel the click event + const touchEnd = () => { + if (Date.now() - touchTimestamp.current < TOOLTIP_DELAY) { clearTimeout(touchTimeout.current); - - open(); + close(); } }; @@ -394,12 +391,14 @@ export function DrawerTooltip({ elem.addEventListener('touchstart', touchStart); elem.addEventListener('touchend', touchEnd); + elem.addEventListener('touchcancel', touchEnd); return () => { elem.removeEventListener('scroll', scroll); elem.removeEventListener('touchstart', touchStart); elem.removeEventListener('touchend', touchEnd); + elem.removeEventListener('touchcancel', touchEnd); clearTimeout(touchTimeout.current); }; }