Skip to content

Tooltip can appear after its owner resigns key during the delayed-show interval #809

Description

@baron

Impact

The shared tooltip lifecycle fix dismisses an already-created tooltip when its owner moves, closes, or resigns key. It does not cover lifecycle events that occur during the 300 ms hover delay before the tooltip controller exists.

A tooltip can therefore appear after its owner already opened a popover or lost key-window status, leaving a stale floating tooltip above the new surface.

Regression/follow-up context

Reproduction

  1. Hover a toolbar control with .hoverTooltip.
  2. Before the 300 ms delay expires, click the control or otherwise cause its owner to resign key/open a popover.
  3. Keep the pointer positioned so the scheduled work remains pending.
  4. Observe the tooltip being constructed and ordered front after the lifecycle transition.

The MCP Server toolbar button is one reachable trigger:

  • Sources/RepoPrompt/Infrastructure/UI/Components/MCPServerToggleView.swift:97-108

Expected behavior

Any owner/surface lifecycle transition during the delay invalidates pending tooltip presentation.

Actual behavior

Hover schedules delayed work before lifecycle observers or input monitors exist:

  • Sources/RepoPrompt/Infrastructure/UI/Components/TooltipBubble.swift:71
  • Sources/RepoPrompt/Infrastructure/UI/Components/TooltipBubble.swift:129-157
  • Sources/RepoPrompt/Infrastructure/UI/Components/TooltipBubble.swift:196-218

Owner observers are installed only when the controller is created:

  • Sources/RepoPrompt/Infrastructure/UI/Tooltip/TooltipOverlayController.swift:200-229

Presentation validates only that the owner remains visible:

  • Sources/RepoPrompt/Infrastructure/UI/Tooltip/TooltipOverlayController.swift:53-57

An already-emitted didResignKeyNotification is not replayed to observers installed afterward.

Acceptance criteria

  • Owner resignation, close, movement, popover/sheet presentation, or relevant click during the delayed-show interval cancels/invalidate the pending tooltip.
  • Tooltip presentation validates a captured owner lifecycle generation or equivalent current-owner state.
  • Existing behavior for a stable active owner remains unchanged.
  • Regression tests cover lifecycle change before the delay expires, not only an already-visible tooltip.
  • Geometry and multi-window isolation tests remain green.

Validation status

Confirmed by static lifecycle ordering. No AppKit UI reproduction was run.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguxUser experience and interaction design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions