Skip to content

fix(ui): open neighbouring tooltips without the full delay - #58971

Merged
opencode-agent[bot] merged 2 commits into
devfrom
fix/review-toolbar-tooltips
Oct 25, 2026
Merged

opencode-agent[bot] merged 2 commits into
devfrom
fix/review-toolbar-tooltips

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Hovering across the review toolbar's segmented controls (Show all lines / Hide non-diff lines / Unified diff / Split diff) shows tooltips inconsistently. When you move from a tooltip that's showing to the button next to it, the second tooltip often waits the full open delay (2s on these buttons) and doesn't appear unless you keep hovering.

Cause

Tooltip passes its own onPointerLeave to Kobalte's trigger, and that handler closes the tooltip directly. Kobalte runs the passed handler before its own, so Kobalte sees the tooltip as already closed. It then calls cancelOpening() instead of hideTooltip(), which means the skipDelayDuration window that lets the next tooltip open immediately never starts.

Fix

Defer the wrapper's close/unblock to a microtask, so Kobalte's leave handler still sees the tooltip open and starts the skip-delay window. The tooltip still closes on leave, and the click/expanded-content blocking stays the same.

Verification

I used a scratch Vite page (not committed) with the same two segmented controls and openDelay={2000}, driven by headless Chromium. Hover one button for 2.2s, then move across neighbours with 250ms on each:

  • before: Show ✅ → Hide ❌ → Show ✅ → Hide ❌ → Unified ✅ → Split ❌ → Unified ✅
  • after: all seven ✅

In both cases, leaving the controls closes the tooltip, and hovering again after that still waits the full delay (nothing shows at 600ms, it shows at 2.4s).

bun run typecheck in packages/ui passes. packages/ui has no DOM tests for tooltips. Not yet checked in the desktop app.

Test update

session-question-dock.spec.ts hovers Submit and then Back. Back's tooltip now opens right away, while Submit's is still in its 80ms fade-out, so a bare getByRole("tooltip") matches two elements. The assertion now targets Back's tooltip by name.

Requested by: @vimtor (victor via Slack)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is sound and minimal. On the base, a tooltip next to one that was showing waited the full delay; with this change it opens immediately.

I tested it in a Bun + happy-dom harness, because neither checkout had a browser binary. The harness compiles the real Tooltip and Kobalte code with babel-preset-solid and renders three adjacent tooltips with openDelay={2000}. I hovered one, then moved across its neighbours with 250ms on each:

  • Base: the open / skipped / open pattern from the description.
  • This PR: every neighbour opened at once. Leaving still closes the tooltip, and hovering again still waits the full delay.

Kobalte 0.13.13's trigger confirms the cause: hideTooltip(), which starts the skip-delay window, only runs if the tooltip is still open when Kobalte's own pointerleave handler runs. Otherwise it calls cancelOpening(). I haven't checked the desktop app or a real browser.

packages/ui tests pass (153 passed, 0 failed), and tsc --noEmit is clean.

Public API is unchanged; this is internal to the UI Tooltip component.

Related: #50811

@opencode-agent
opencode-agent Bot merged commit efb6b1d into dev Oct 25, 2026
22 checks passed
@opencode-agent
opencode-agent Bot deleted the fix/review-toolbar-tooltips branch October 25, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant