Skip to content

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

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

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.
@0xNino 0xNino closed this Jun 29, 2026
@0xNino
0xNino deleted the fix/mcp-toolbar-tooltip-dismiss-on-click branch June 29, 2026 15:28
@rodgomesc

Copy link
Copy Markdown

@0xNino Why did you closed the PR? The issue is still happening. I almost went crazy over the last hour, debugging my Mac processes to figure out what the heck this pop-up was. My immediate thought was that someone was watching my machine through a backdoor 🫠

image

@baron

baron commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@rodgomesc are you on v1.0.29 (the current)? If you can confirm we'd be happy to re-open this PR or fix it separately. Sorry it's happening to you.

@0xNino

0xNino commented Jul 16, 2026

Copy link
Copy Markdown
Author

I closed this PR because I was not satisfied with the breadth of the original approach and wanted to revisit the fix against current main.

The bug is now tracked in #563 and reproduced on RepoPrompt CE v1.0.29 (30). A narrower replacement is open as #564.

The replacement changes only the shared TooltipOverlayController: standalone tooltips now dismiss when their owner closes, moves, or resigns key-window status. It does not add the global dismiss coordinator, MCP-specific call sites, or invalid-anchor changes proposed here. The patched debug build has been manually validated against the reported MCP popover flow.

Please continue review and discussion in #563 / #564.

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.

3 participants