We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b395a4 commit 6d2a880Copy full SHA for 6d2a880
src/components/Tooltip/Tooltip.tsx
@@ -643,6 +643,9 @@ const Tooltip = ({
643
const newId = (mutation.target as HTMLElement).getAttribute('data-tooltip-id')
644
if (newId === id) {
645
newAnchors.push(mutation.target as HTMLElement)
646
+ } else if (mutation.oldValue === id) {
647
+ // data-tooltip-id has now been changed, so we need to remove this anchor
648
+ removedAnchors.push(mutation.target as HTMLElement)
649
}
650
651
if (mutation.type !== 'childList') {
@@ -727,6 +730,8 @@ const Tooltip = ({
727
730
subtree: true,
728
731
attributes: true,
729
732
attributeFilter: ['data-tooltip-id'],
733
+ // to track the prev value if we need to remove anchor when data-tooltip-id gets changed
734
+ attributeOldValue: true,
735
})
736
return () => {
737
documentObserver.disconnect()
0 commit comments