Skip to content

Commit

Permalink
Fix [UI] Tooltip doesn’t always hide on mouse out (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-prokopchuk authored Jul 8, 2024
1 parent 08d85d8 commit 6cfc3d3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ const Tooltip = ({ children, className, hidden, id, renderChildAsHtml, template,

const handleMouseLeave = useCallback((event) => {
if (
(tooltipRef.current &&
!tooltipRef.current.contains(event.relatedTarget) &&
parentRef.current &&
!parentRef.current.contains(event.relatedTarget)) ||
hidden
!tooltipRef.current || hidden ||
(tooltipRef.current && !tooltipRef.current.contains(event.relatedTarget) &&
parentRef.current && !parentRef.current.contains(event.relatedTarget))
) {
setShow(false)
}
Expand Down

0 comments on commit 6cfc3d3

Please sign in to comment.