Skip to content

Tooltip stays open after its trigger is unmounted when ConfigProvider tooltip.unique is enabled #59603

Open
react-component/trigger
#649

Description

@MR-Mostafa

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Enable unique tooltips with <ConfigProvider tooltip={{ unique: true }}>.
  2. Render a Button wrapped in a Tooltip that is removed from the page when clicked.
  3. Hover over the button and wait for the tooltip to appear.
  4. While the tooltip is visible, click the button.
import { useState } from "react";
import { Button, ConfigProvider, Tooltip } from "antd";

export default () => {
  const [show, setShow] = useState(true);

  return (
    <ConfigProvider tooltip={{ unique: true }}>
      {show && (
        <Tooltip title="Hello, Ant Design!">
          <Button type="primary" onClick={() => setShow(false)}>
            Click Button
          </Button>
        </Tooltip>
      )}

      <Button type="primary" color="danger" onClick={() => setShow(true)}>
        Reset State
      </Button>
    </ConfigProvider>
  );
};

What is expected?

The tooltip should close when its Tooltip and trigger element are unmounted, the same as when tooltip.unique is not enabled.

What is actually happening?

The tooltip popup stays on screen after its trigger element has been removed from the DOM. It only closes after hovering over another element that has a tooltip.

Without tooltip.unique, the same code works correctly.

Environment Info
antd 6.6.6
React 19.2.4
System GNU/Linux Ubuntu
Browser Google Chrome 155

Activity

  1. yulman2207 commented on Oct 19, 2026

    @yulman2207

    Hi! I’m investigating this issue and plan to submit a fix with a regression test once I’ve reproduced it. I’ll check that unmounting a Tooltip closes its unique popup without affecting another active tooltip.

  2. yulman2207 commented on Oct 22, 2026

    @yulman2207

    @MR-Mostafa For visibility to the maintainers: I already submitted a fix for this issue in react-component/trigger#649 on October 19, following my earlier comment here. That PR remains open and includes 16 regression cases covering controlled/uncontrolled visibility, preserving other active owners, delayed callbacks, StrictMode, and unmounts during popup motion. Its description also records validation against the Ant Design reproduction.

    The newly linked react-component/trigger#650 addresses the same issue. Could the maintainers please review the existing #649 and coordinate the overlapping PRs so the earlier implementation and test coverage are considered? I’m available to address review feedback on #649. Linking both here to keep the existing work visible and avoid duplicated effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions