react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

[BUG] Tooltip state not updating correctly after the tooltip ID on an element changes

Open profaurore opened this issue 1 month ago • 1 comments

Bug description

When the data-tooltip-id value changes on an element while the pointer is over it, timeouts and state are not being cleared.

  1. The pointer is over an element with a data-tooltip-id matching the Tooltip's ID.
  2. An element's data-tooltip-id changes. (reference)
  3. The element is marked for removal. (reference)
  4. The element is removed from the set of anchors. (reference)
  5. activeAnchor is no longer in the list of anchors. (reference)
  6. activeAnchor resets to the first item in the set of anchors. (reference)
  7. In progress timeouts and state are applied to the new anchor. When using tooltips with show delays, this results in a tooltip appearing on the active anchor, which is not the hovered element.

I believe the fix is to apply the same clearing logic as is applied when the active anchor is removed from the DOM (reference), but I may be missing something.

Version of Package v5.30.0

To Reproduce

I haven't found a consistent reproduction of this issue.

Expected behavior

When an element's data-tooltip-id, the state of the tooltip should adjust accordingly.

Screenshots

Example issue:

Image

Desktop:

  • OS: Mac OS 15.6.1
  • Browser: Chrome
  • Version: 142.0.7444.60 (arm64)
  • Frameworks: React 18.2.0

Additional context

N/A

profaurore avatar Nov 11 '25 20:11 profaurore