-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(tooltip): prevent tooltip from staying visible when clicking triggers that open overlays #5914
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
base: v3
Are you sure you want to change the base?
Conversation
This fix resolves issue heroui-inc#5912 for v3 where the tooltip would stay open when clicking a button that also triggers a popover. Changes: - Added onClick handler to TooltipRoot (TooltipTriggerPrimitive wrapper) - Handler dispatches a mouseleave event to trigger React Aria's close logic - Works with both direct children (Button) and Tooltip.Trigger patterns - Maintains backward compatibility with all existing v3 tooltip usage The fix intercepts clicks at the root level, ensuring tooltips close regardless of how the trigger element is structured, preventing visual overlap when popovers or other overlays open. Closes heroui-inc#5912 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…ons with popovers Fixes heroui-inc#5912 When a button with a tooltip is clicked to open a popover or dialog, the tooltip now properly closes and stays closed instead of remaining visible over the overlay. The fix works by: 1. Using controlled `isOpen` state on TooltipTrigger to manage tooltip visibility 2. When tooltip closes (via onOpenChange), setting a `forceHide` flag in context 3. TooltipContent component checks `forceHide` and returns null to prevent rendering 4. After 500ms, clearing `forceHide` to restore normal tooltip behavior This approach ensures the tooltip doesn't interfere with popover/dialog interactions while maintaining normal hover behavior for subsequent interactions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Clarify comment to mention overlays (not just popovers) for accuracy - Add detailed explanation of 500ms timeout rationale - Simplify WithPopover story to be more user-friendly and less verbose - Remove test-specific language from story, make it a useful example 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🦋 Changeset detectedLatest commit: ac144b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@driuqzy is attempting to deploy a commit to the HeroUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Description
Fixes #5912
This PR resolves an issue where tooltips remain visible when clicking a button that opens other overlays (popovers, menus, dialogs, etc.).
The Problem
When a user:
This happens because React Aria attempts to reopen the tooltip immediately after it closes (since the mouse is still hovering), creating a race condition.
The Solution
Implements a "force-hide" mechanism that:
The fix uses React Aria's official controlled state API (
isOpen/onOpenChange) and is completely generic—it works with all overlays (popovers, menus, dialogs) and any click action.Changes
WithPopoverstory demonstrating the fixTesting
Test in Storybook:
Notes