Skip to content

Commit 699fbb0

Browse files
fix: handle click event correctly
1 parent 08bfc6f commit 699fbb0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ const Tooltip = ({
516516
const enabledEvents: { event: string; listener: (event?: Event) => void }[] = []
517517

518518
const handleClickOpenTooltipAnchor = (event?: Event) => {
519-
if (show && event?.target === activeAnchor) {
519+
if (show && event?.target?.contains(activeAnchor)) {
520520
/**
521521
* ignore clicking the anchor that was used to open the tooltip.
522522
* this avoids conflict with the click close event.
@@ -526,7 +526,7 @@ const Tooltip = ({
526526
handleShowTooltip(event)
527527
}
528528
const handleClickCloseTooltipAnchor = (event?: Event) => {
529-
if (!show || event?.target !== activeAnchor) {
529+
if (!show || !event?.target?.contains(activeAnchor)) {
530530
/**
531531
* ignore clicking the anchor that was NOT used to open the tooltip.
532532
* this avoids closing the tooltip when clicking on a

0 commit comments

Comments
 (0)