diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 02d6354c..b625d4fa 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -244,6 +244,12 @@ const Tooltip = ({ clearTimeout(tooltipShowDelayTimerRef.current) } + if (rendered) { + // if the tooltip is already rendered, ignore delay + handleShow(true) + return + } + tooltipShowDelayTimerRef.current = setTimeout(() => { handleShow(true) }, delay) @@ -629,6 +635,8 @@ const Tooltip = ({ closeEvents, globalCloseEvents, shouldOpenOnClick, + delayShow, + delayHide, ]) useEffect(() => { @@ -800,6 +808,13 @@ const Tooltip = ({ } }, [id, anchorSelect, imperativeOptions?.anchorSelect]) + useEffect(() => { + if (tooltipShowDelayTimerRef.current) { + clearTimeout(tooltipShowDelayTimerRef.current) + handleShowTooltipDelayed(delayShow) + } + }, [delayShow]) + const actualContent = imperativeOptions?.content ?? content const canShow = show && Object.keys(inlineStyles).length > 0