Skip to content

Commit 7039fef

Browse files
committedMar 18, 2022
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.
1 parent f318ecf commit 7039fef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎packages/tooltip/src/useTooltip.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,10 @@ export function useTooltip<E extends HTMLElement>({
517517
return;
518518
}
519519

520-
window.addEventListener("touchmove", hide, true);
520+
window.addEventListener("scroll", hide, true);
521521
window.addEventListener("touchend", hide, true);
522522
return () => {
523-
window.removeEventListener("touchmove", hide, true);
523+
window.removeEventListener("scroll", hide, true);
524524
window.removeEventListener("touchend", hide, true);
525525
};
526526
}, [hide, initiatedBy, setVisible]);

0 commit comments

Comments
 (0)
Please sign in to comment.