From 699fbb0e10940961870f089f2dbe429c7616700c Mon Sep 17 00:00:00 2001 From: Gabriel Jablonski Date: Tue, 3 Sep 2024 10:55:32 -0300 Subject: [PATCH] fix: handle click event correctly --- src/components/Tooltip/Tooltip.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 1471e930..938ac64d 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -516,7 +516,7 @@ const Tooltip = ({ const enabledEvents: { event: string; listener: (event?: Event) => void }[] = [] const handleClickOpenTooltipAnchor = (event?: Event) => { - if (show && event?.target === activeAnchor) { + if (show && event?.target?.contains(activeAnchor)) { /** * ignore clicking the anchor that was used to open the tooltip. * this avoids conflict with the click close event. @@ -526,7 +526,7 @@ const Tooltip = ({ handleShowTooltip(event) } const handleClickCloseTooltipAnchor = (event?: Event) => { - if (!show || event?.target !== activeAnchor) { + if (!show || !event?.target?.contains(activeAnchor)) { /** * ignore clicking the anchor that was NOT used to open the tooltip. * this avoids closing the tooltip when clicking on a