chore: Update ToolTip to default to be dismissed after parent target is clicked#3388
chore: Update ToolTip to default to be dismissed after parent target is clicked#3388LinKCoding wants to merge 14 commits into
Conversation
|
View your CI Pipeline Execution ↗ for commit 061b086 ☁️ Nx Cloud last updated this comment at |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3388 +/- ##
==========================================
- Coverage 90.55% 90.10% -0.46%
==========================================
Files 398 270 -128
Lines 6586 5699 -887
Branches 2141 1924 -217
==========================================
- Hits 5964 5135 -829
+ Misses 613 555 -58
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a9a3a7a to
2c47b8e
Compare
|
|
||
| return ( | ||
| <ToolTip info={tip} {...(tipProps as any)}> | ||
| <ToolTip closeOnClick info={tip} {...(tipProps as any)}> |
There was a problem hiding this comment.
very similar to still including info as a prop, where it gets overridden if tipProps includes info --
where if tipProps doesn't include closeOnClick, then closeOnClick becomes the default (the ToolTip disappears after the target is clicked)
e4cfa8d to
061b086
Compare
|
📬 Published Alpha Packages:
|
|
🚀 Styleguide deploy preview ready! Preview URL: https://6a4eb53c587f953067800df9--gamut-preview.netlify.app |
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