Fixed: Links tooltip closing too quickly

series-links-on-ios
Mark McDowall 6 months ago committed by Mark McDowall
parent 0e384ee3aa
commit 0b9a212f33

@ -65,8 +65,7 @@ function Tooltip(props: TooltipProps) {
const handleMouseLeave = useCallback(() => { const handleMouseLeave = useCallback(() => {
// Still listen for mouse leave on mobile to allow clicks outside to close the tooltip. // Still listen for mouse leave on mobile to allow clicks outside to close the tooltip.
closeTimeout.current = window.setTimeout(() => {
setTimeout(() => {
setIsOpen(false); setIsOpen(false);
}, 100); }, 100);
}, [setIsOpen]); }, [setIsOpen]);
@ -111,18 +110,18 @@ function Tooltip(props: TooltipProps) {
); );
useEffect(() => { useEffect(() => {
const currentTimeout = closeTimeout.current;
if (updater.current && isOpen) { if (updater.current && isOpen) {
updater.current(); updater.current();
} }
});
useEffect(() => {
return () => { return () => {
if (currentTimeout) { if (closeTimeout.current) {
window.clearTimeout(currentTimeout); window.clearTimeout(closeTimeout.current);
} }
}; };
}); }, []);
return ( return (
<Manager> <Manager>

Loading…
Cancel
Save