Skip to content

Commit 37cab51

Browse files
committed
Minor adjustments
1 parent 8878931 commit 37cab51

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const Tooltip = ({
233233
} else {
234234
removeAriaDescribedBy(activeAnchor)
235235
}
236-
}, [activeAnchor, show])
236+
}, [activeAnchor, show, id, previousActiveAnchor])
237237

238238
/**
239239
* this replicates the effect from `handleShow()`

src/components/TooltipController/TooltipController.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,12 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
378378
activeAnchor,
379379
previousActiveAnchor: previousActiveAnchorRef.current,
380380
setActiveAnchor: (anchor: HTMLElement | null) => {
381-
if (!anchor?.isSameNode(activeAnchor)) {
382-
previousActiveAnchorRef.current = activeAnchor
383-
}
384-
setActiveAnchor(anchor)
381+
setActiveAnchor((prev) => {
382+
if (!anchor?.isSameNode(prev)) {
383+
previousActiveAnchorRef.current = prev
384+
}
385+
return anchor
386+
})
385387
},
386388
role,
387389
}

0 commit comments

Comments
 (0)