first attempt at closing tooltip after click#3388
Draft
LinKCoding wants to merge 14 commits into
Draft
Conversation
|
View your CI Pipeline Execution ↗ for commit e4cfa8d ☁️ Nx Cloud last updated this comment at |
|
a9a3a7a to
2c47b8e
Compare
Collaborator
|
📬 Published Alpha Packages:
|
Contributor
|
🚀 Styleguide deploy preview ready! Preview URL: https://6a457f13fff259465eba665b--gamut-preview.netlify.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds close-on-click behavior to
ToolTipandIconButtontooltips. By default, hovering over anIconButtonshows its tooltip — clicking the button now immediately hides it, requiring the cursor to leave and re-enter before it reappears. An opt-out (closeOnClick={false}) supports patterns like copy → copied where the tooltip should stay visible after the click.closeOnClickprop toToolTipPropsandTipPlacementComponentPropsInlineTipusing a CSSsuppressstate onToolTipWrapperthat overrides the base:hoverstyles by injection orderdata-tooltip-bodyattribute to target only the tooltip body element in the CSS selector, avoiding interference withTargetContainer:focus-withinto:has(:focus-visible)to prevent mouse-click focus from keeping the tooltip aliverelatedTarget instanceof Nodeguard ononMouseEnter/onMouseLeaveto skip synthetic events fired when tooltip visibility changesIconButtonnow passescloseOnClickby default; override viatipProps={{ closeOnClick: false }}FloatingTipto forwardcloseOnClickto the inner tipMenuItemtooltip element to align with blur-close behaviorIconButton.test.tsxcoveringcloseOnClickscenariosCloseOnClickstory to bothIconButton.stories.tsxandToolTip.stories.tsxwith floating/inline variants; updated corresponding MDX docsPR Checklist
Testing Instructions
Don't make me tap the sign.
IconButton— the tooltip should appear. Click the button; the tooltip should disappear immediately even though the cursor is still hovering. Move the cursor off and back on — the tooltip should reappear normally.closeOnClick={false}) stay open after clicking.StrokeButtonwrapped in<ToolTip>directly — two close on click, two stay open.IconButtonusing keyboard only — the tooltip should appear on:focus-visibleand should not be suppressed by a prior mouse click.PR Links and Envs