From 7039fef0b7003a5288ee855c7710b7a53d4a66d9 Mon Sep 17 00:00:00 2001 From: Mikkel Laursen Date: Fri, 11 Mar 2022 16:31:08 -0700 Subject: [PATCH] fix(tooltip): Tooltips stay visible on mobile Firefox It looks like mobile Firefox triggers a touchmove event around the same time as a contextmenu event which caused the hide() function to trigger. Changing it to a scroll event instead of touchmove fixes the behavior so that a user touching a tooltipped element and starts scrolling the page does not cause the tooltip to appear. --- packages/tooltip/src/useTooltip.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tooltip/src/useTooltip.ts b/packages/tooltip/src/useTooltip.ts index 1a171f2ee2..6e19e6c081 100644 --- a/packages/tooltip/src/useTooltip.ts +++ b/packages/tooltip/src/useTooltip.ts @@ -517,10 +517,10 @@ export function useTooltip({ return; } - window.addEventListener("touchmove", hide, true); + window.addEventListener("scroll", hide, true); window.addEventListener("touchend", hide, true); return () => { - window.removeEventListener("touchmove", hide, true); + window.removeEventListener("scroll", hide, true); window.removeEventListener("touchend", hide, true); }; }, [hide, initiatedBy, setVisible]);