You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Tooltip: a tooltip dismissed with Escape opens again while the pointer stays on its trigger #11895
A tooltip dismissed with Escape opens again while the mouse pointer stays on its trigger. When the tooltip surface covers the resting pointer, as it can over a trigger whose hit area reaches past its box, each Escape only hides it for the hover delay: hiding the surface puts the trigger back under the pointer, the browser fires mouseenter on it with no pointer movement, and the tooltip shows again. A dialog or sheet under the tooltip never gets the next Escape, so a keyboard user can't close it without moving the mouse.
Cause: onDismiss in useTooltip hides the layer but records nothing (useTooltip.tsx#L912-L946), and the trigger's next mouseenter schedules a show as for a new hover (#L515-L523, listener at #L772). WCAG 1.4.13 asks that hover content be dismissible "without moving pointer hover or keyboard focus"; content that comes back while the pointer stays put isn't dismissed.
Related: #11605 and its open fix #11831 start the show delay only on a pointer move. That stops the loop below, which has no move, but a dismissed tooltip still opens again on the first small move inside its trigger.
Reproduction
import{Tooltip}from'@astryxdesign/core/Tooltip';// A trigger whose hit area reaches 16px past its box, as a touch-size target does.constcss=`.trigger{position:relative} .trigger::after{content:'';position:absolute;inset:-16px}`;exportfunctionRepro(){return(<divstyle={{padding: 120}}><style>{css}</style><Tooltipcontent="Describes the button"><buttonclassName="trigger">Hover me</button></Tooltip></div>);}
Move the mouse to 6px above the button (inside its hit area) and keep it still. The tooltip opens above the button, under the pointer.
Press Escape, wait 600ms, and repeat.
Actual: after each Escape the trigger receives pointerenter and mouseenter (no pointermove), and the tooltip is :popover-open again 600ms later, every time.
Control: with the pointer resting on the button's centre, outside the surface, one Escape closes the tooltip for good.
Expected: a tooltip dismissed with Escape stays closed until the pointer leaves its trigger and enters it again, or until focus leaves and comes back.
Workaround: an app can stop the trigger's mouseenter in the capture phase after an Escape until a pointermove lands outside the trigger.
Astryx Version
@astryxdesign/core@0.7.16, unchanged on main (b1441b7)
Environment
Firefox 157 and Chromium 156 (Playwright, headless), Linux; the repro above bundled with Vite, with the trusted events logged on the trigger. Firefox also shows it for a trigger under a resting pointer after another layer above it closes.
My plan: in useTooltip, record an Escape dismissal in onDismiss and suppress the re-show until the pointer leaves the trigger and enters it again (or focus leaves and comes back), then add a regression test for the Escape-then-still-pointer case.
How does this relate to the open fix #11831 for #11605 — should this be a separate PR, or folded into that work?
Thanks for taking it. I'd keep it a separate PR: #11831 is about a trigger that appears under a pointer that never moved, while this one is about re-showing after an Escape dismissal. They share useTooltip but have different conditions and tests, so separate PRs are easier to review and revert. If #11831 lands first, build on it. Your plan (suppress until the pointer leaves and re-enters, or focus leaves and returns) matches the expected behaviour in the report.
(Posted by Cindy's agent.) Thanks @duytbp for the report. A tooltip dismissed with Escape should stay dismissed while the pointer rests on its trigger, so this is a bug. @ravindrasinghshah, if you're still working on it, please open a PR; otherwise we'll pick it up and credit your plan. We'll update here.
(Posted by Cindy's agent.) Thanks @duytbp for the report. A tooltip dismissed with Escape should stay dismissed while the pointer rests on its trigger, so this is a bug. @ravindrasinghshah, if you're still working on it, please open a PR; otherwise we'll pick it up and credit your plan. We'll update here.
@cixzhang - Thank you for confirming, I have raised the PR for review.
Activity
ravindrasinghshah commentedon Nov 15, 2026
Hi, I'd like to take this one.
My plan: in useTooltip, record an Escape dismissal in onDismiss and suppress the re-show until the pointer leaves the trigger and enters it again (or focus leaves and comes back), then add a regression test for the Escape-then-still-pointer case.
How does this relate to the open fix #11831 for #11605 — should this be a separate PR, or folded into that work?
duytbp commentedon Nov 16, 2026
Thanks for taking it. I'd keep it a separate PR: #11831 is about a trigger that appears under a pointer that never moved, while this one is about re-showing after an Escape dismissal. They share
useTooltipbut have different conditions and tests, so separate PRs are easier to review and revert. If #11831 lands first, build on it. Your plan (suppress until the pointer leaves and re-enters, or focus leaves and returns) matches the expected behaviour in the report.cixzhang commentedon Nov 19, 2026
(Posted by Cindy's agent.) Thanks @duytbp for the report. A tooltip dismissed with Escape should stay dismissed while the pointer rests on its trigger, so this is a bug. @ravindrasinghshah, if you're still working on it, please open a PR; otherwise we'll pick it up and credit your plan. We'll update here.
fix(Tooltip): keep Escape-dismissed tooltip closed while pointer rest…
ravindrasinghshah commentedon Nov 19, 2026
@cixzhang - Thank you for confirming, I have raised the PR for review.
fix(Tooltip): arm Escape-dismissal guard only while pointer is over t…
fix(Tooltip): type surface mouseleave handler as React MouseEvent (me…
fix(Tooltip): reset pointer state when a disabled trigger detaches (m…
chore(Tooltip): tighten Escape-dismissal comment wording (meta#11895)