Skip to content

Dismiss hover tooltips when MCP toolbar buttons open a surface#227

Open
0xNino wants to merge 1 commit into
repoprompt:mainfrom
0xNino:fix/mcp-toolbar-tooltip-dismiss-on-click
Open

Dismiss hover tooltips when MCP toolbar buttons open a surface#227
0xNino wants to merge 1 commit into
repoprompt:mainfrom
0xNino:fix/mcp-toolbar-tooltip-dismiss-on-click

Conversation

@0xNino

@0xNino 0xNino commented Jun 15, 2026

Copy link
Copy Markdown

Problem

Clicking the MCP connections counter (the green link/count pill) or the MCP Server toggle in the toolbar could leave a hover tooltip floating over the freshly opened status window / popover.

Why it sticks:

  • A hover tooltip's only auto-dismiss paths are hover-exit (onHover(false)) and the click/scroll/key event monitors — but those monitors are installed only after the tooltip becomes visible (after the 300 ms hover delay). A click that lands during that delay can't dismiss it.
  • When the button opens a new window/popover, that surface appears under the cursor and steals focus, so the button's onHover(false) never fires.
  • The tooltip overlay renders at .floating window level, so it sits on top of the newly opened surface — very visibly stuck until the next unrelated click/scroll/keypress.

A second, related failure: a stale/empty anchor geometry report (e.g. .zero during a layout/window transition) fed owner.convertToScreen(.zero), snapping the bubble to the owner window's bottom-left corner.

Fix

  • Add HoverTooltipCoordinator.dismissAll(), which posts a notification observed by both HoverTooltipModifier and TooltipOverlayController. The modifier-side cleanup cancels a pending-but-unshown tooltip as well as hiding a visible one. The two MCP toolbar buttons call it before opening their surface.
  • Guard show() / reposition() against empty or non-finite anchor rects — hide instead of mispositioning to the window origin.
  • Refactor observer install/teardown so the new dismiss observer is cleaned up alongside the owner-will-close observer.

Tests

Adds TooltipOverlayControllerTests covering dismiss-all and the invalid-anchor show/reposition paths.

Validation

  • make dev-lint — 0 violations (format-check + SwiftLint strict)
  • make dev-test — full suite green (run via push preflight); new suite passes, stable across repeated runs
  • make dev-swift-build PRODUCT=RepoPrompt — clean
  • Contribution preflight passed in commit and push modes (staged-index + outgoing-range secret scans)

UI-only change; does not touch MCP CLI/server, Agent Mode, or packaging.

Screenshot

This shows the issue: the MCP status surface opens while the hover tooltip remains floating over any app.

Screenshot 2026-06-15 at 15 09 53 Screenshot 2026-06-15 at 15 09 09

Clicking the MCP connections counter or server toggle could leave a
hover tooltip floating over the freshly opened status window/popover:
the tooltip's auto-dismiss paths (hover-exit and the click/scroll/key
event monitors installed only after it becomes visible) don't fire when
a new window steals focus under the cursor, and the tooltip renders at
.floating level so it sits on top of the new surface.

- Add HoverTooltipCoordinator.dismissAll() posting a notification that
  both HoverTooltipModifier and TooltipOverlayController observe; the
  modifier cleanup cancels pending-but-unshown tooltips as well as
  hiding visible ones. Call it from the two MCP toolbar buttons.
- Guard show()/reposition() against empty or non-finite anchor rects so
  a stale .zero geometry report no longer snaps the bubble to the owner
  window's bottom-left corner; hide instead.
- Refactor observer install/teardown so the new dismiss observer is
  cleaned up alongside the owner-will-close observer.

Add TooltipOverlayControllerTests covering dismiss-all and the
invalid-anchor show/reposition paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant