Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When multiple tooltips are open controlled, the first tooltip would not close after the cursor hovers on the second tooltip. #6233

Open
GuoXiaoyang opened this issue Apr 19, 2024 · 1 comment
Labels
bug Something isn't working strict mode

Comments

@GuoXiaoyang
Copy link

GuoXiaoyang commented Apr 19, 2024

Provide a general summary of the issue here

When multiple tooltips are open controlled, the first tooltip would not close after the cursor hovers on the second tooltip.

🤔 Expected Behavior?

The first tooltip would close after the cursor hovers on the second tooltip.

😯 Current Behavior

http://localhost:9003/?path=/story/tooltiptrigger--controlled-multiple-tooltips&providerSwitcher-express=false&strict=true

Screen.Recording.2024-04-19.at.11.00.10.AM.mov

💁 Possible Solution

  1. It seems the closeOpenTooltips function in packages/@react-stately/tooltip/src/useTooltipTriggerState.ts is not working properly when the isOpen prop is controlled, when the close handler is called, the currentValue(open) in useControlledState is still false thus not trigger the onOpenChange handler in the Tooltip.
  let closeOpenTooltips = () => {
    for (let hideTooltipId in tooltips) {
      if (hideTooltipId !== id) {
        tooltips[hideTooltipId](true);
        delete tooltips[hideTooltipId];
      }
    }
  };

🔦 Context

No response

🖥️ Steps to Reproduce

  1. The story in the react-spectrum repo can reproduce this issue: http://localhost:9003/?path=/story/tooltiptrigger--controlled-multiple-tooltips&providerSwitcher-express=false&strict=true

Version

3.32.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

Thanks for the issue, looks like a regression was introduced at some point. This story used to work.

Found the PR where it broke #4564

@snowystinger snowystinger added bug Something isn't working strict mode labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working strict mode
Projects
None yet
Development

No branches or pull requests

2 participants