Skip to content

Commit

Permalink
delete useless isHovering
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMarcMilletScality committed Dec 29, 2023
1 parent e1924f0 commit 18782ac
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/lib/components/tooltip/Tooltip.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ function Tooltip({
}: Props) {
const childrenRef = useRef<HTMLDivElement | null>(null);
const tooltipRef = useRef<HTMLDivElement | null>(null);
const isHovering = childrenRef.current
? Array.from(document.querySelectorAll(':hover')).includes(
childrenRef.current,
)
: false;
const [isTooltipVisible, setIsTooltipVisible] = useState(isHovering);

const [isTooltipVisible, setIsTooltipVisible] = useState(false);
useEffect(() => {
if (childrenRef.current && tooltipRef.current) {
computePosition(childrenRef.current, tooltipRef.current, {
Expand All @@ -104,7 +100,7 @@ function Tooltip({
}
});
}
}, [tooltipRef.current, childrenRef.current, isHovering, isTooltipVisible]);
}, [tooltipRef.current, childrenRef.current, isTooltipVisible]);
return (
<TooltipContainer
className="sc-tooltip"
Expand Down

0 comments on commit 18782ac

Please sign in to comment.