Fixed: Links tooltip closing too quickly

This commit is contained in:
Mark McDowall 2024-09-02 16:04:37 -07:00 committed by Mark McDowall
parent 0e384ee3aa
commit 0b9a212f33
1 changed files with 6 additions and 7 deletions

View File

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