fix(desktop): stop tooltips re-opening when a menu/dialog restores focus to its trigger - #66737
Merged
Conversation
…cus to its trigger Picking a model from the composer model pill left the pill's tooltip stuck open over the fresh selection: Radix Tooltip opens on ANY trigger focus (its isPointerDownRef guard only covers a pointerdown on the trigger itself), and Radix menus/dialogs restore focus to their trigger on close — so every mouse-driven pick ended with a phantom tip. Same pattern on every Tip-wrapped trigger that opens an overlay. Gate the focus-open to KEYBOARD focus: the trigger's own onFocus runs before Radix's composed handler and calls preventDefault() unless the trigger matches :focus-visible — composeEventHandlers skips onOpen for defaultPrevented events. Chromium keeps focus-visible modality across the menu round-trip, so a mouse pick's focus restore no longer opens the tip, while Tab-focus still shows it (a11y unchanged). Fails open if :focus-visible is unsupported. Tests cover the three branches (suppress on non-keyboard focus, keep on keyboard focus, fail open on selector error); chat/shell suites green.
OutThisLife
enabled auto-merge
July 18, 2026 05:06
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…cus-open fix(desktop): stop tooltips re-opening when a menu/dialog restores focus to its trigger
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…cus-open fix(desktop): stop tooltips re-opening when a menu/dialog restores focus to its trigger
prmartinow
pushed a commit
to prmartinow/hermes-agent
that referenced
this pull request
Aug 26, 2026
…cus-open fix(desktop): stop tooltips re-opening when a menu/dialog restores focus to its trigger
melon-xf
added a commit
to melon-xf/hermes-agent
that referenced
this pull request
Sep 3, 2026
…cus-open fix(desktop): stop tooltips re-opening when a menu/dialog restores focus to its trigger
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.
Summary
Pick a model from the composer model pill and the pill's tooltip pops up (and stays) over your fresh selection — you didn't hover anything, it's just there. Same phantom tip on any
Tip-wrapped trigger that opens an overlay.Root cause: Radix Tooltip opens on any trigger focus, not just hover — its
isPointerDownRefguard only suppresses the focus-open for a pointerdown on the trigger itself. Radix menus/dialogs restore focus to their trigger when they close, so every mouse-driven "open menu → click an item" round-trip ends with the trigger focused and the tooltip open. Nobody did it on purpose — it's the upstream default interacting with focus-restore.Fix
TooltipTriggergates the focus-open to keyboard focus: its ownonFocusruns before Radix's composed handler and callspreventDefault()unless the trigger matches:focus-visible(composeEventHandlersskips Radix'sonOpenfor default-prevented events — verified against the installed@radix-ui/primitive). Chromium keeps focus-visible modality across the menu round-trip, so::focus-visibleunsupported → fails open to the previous behaviorOne central change in
ui/tooltip.tsx; everyTip/TooltipTriggercall site inherits it.Verification
npx vitest run src/components/ui/ src/app/chat/ src/app/shell/— 167 tests greentsc --noEmit, eslint, prettier — clean