Skip to content

fix(ui): keep an interactive tooltip preview open while it scrolls - #3339

Merged
kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix
Oct 10, 2026
Merged

kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:fmy/bugfix

Conversation

@kev1n77

@kev1n77 kev1n77 commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Keep the hover preview of a flow-chat sub-agent card open while the reader scrolls the preview itself. The shared interactive Tooltip dismissed on every capture-phase scroll event, including a mouse wheel over its own scroll container and a drag on its own scrollbar, so the metadata below the fold could not be read.

Fixes: N/A (no linked issue)

Type and Areas

Type:

bug fix

Areas:

web UI, design system (@openbitfun/ui)

Motivation / Impact

Hovering a sub-agent control tool card opens a preview with the agent identity, model, and task description. That body is capped at --openbitfun-overlay-tooltip-max-block-size (320px) with overflow-y: auto, so a long task description has to be scrolled to be read. An open tooltip subscribes to capture-phase scroll on the window to dismiss itself once its anchor surface moves. Scroll events do not bubble, but they still travel through the capture phase, so a scroll inside the tooltip's own content container reached that window listener and closed the preview exactly when the reader was scrolling it: the wheel over the preview, and a drag on the preview scrollbar, both dismissed it. Now a scroll event whose target sits inside the tooltip surface is ignored, while a scroll owned by the surface behind the trigger (the transcript) still dismisses the preview. Escape, outside press, delayed hover close, click persistence, and viewport-exit dismissal are unchanged.

Verification

  • pnpm --dir src/web-ui exec vitest run src/shared/ui/Tooltip.test.tsx src/flow_chat/tool-cards/AgentControlToolCard.test.tsx src/flow_chat/tool-cards/TaskToolDisplay.test.tsx -> 3 files, 65 tests passed. The new case keeps an interactive preview open while its own scroll container scrolls scrolls the tooltip root and its content container and expects the same popup node, then scrolls the surface behind the trigger and expects dismissal. Reverting the production change makes that case fail (verified locally), so the case covers the regression rather than the current shape.
  • pnpm --filter @openbitfun/ui run test (UI package build plus node --test tests/*.test.mjs) -> 326 tests passed, 0 failed.
  • pnpm --dir design-system run test -> the @openbitfun/ui package and its four tooltip tests pass in that run. The chain still fails in packages/flow-chat-presentation/tests/catalog.test.tsx on the same two tool-catalog assertions (AgentDelete, AgentInterrupt, Task, AgentControl, ListWorkspaces); those reproduce on a clean checkout of this base commit with the change stashed, so they are not caused by this PR.
  • Not covered: no manual run on a live desktop build, and no remote scenario (remote workspace, remote control, peer device mode, detached dispatch) was exercised. The change is local tooltip behavior and is exercised through the JSDOM scroll contracts above only.

Reviewer Notes

  • Intent kept: scrolling the transcript while the preview is open still dismisses the preview, because the trigger itself moves; the preview body keeps overscroll-behavior: contain, so scrolling it to the end does not chain into the transcript behind it.
  • The guard is event.target instanceof Node && surface.contains(event.target), so the visualViewport scroll path is untouched (its target is not a Node) and the cross-realm fallback still dismisses.
  • No CSS, theme token, or locale change is involved.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

An open tooltip subscribes to capture-phase scroll events so a moving anchor never leaves a stale preview behind. Scrolling the tooltip's own scroll container is not a moving anchor: with the wheel over the sub-agent preview, or a drag on the preview scrollbar, that listener closed the preview exactly when the reader was scrolling it to read the rest of the task description.

Ignore scroll events whose target sits inside the tooltip surface so the preview body can be scrolled, while a scroll owned by the surface behind the trigger still dismisses it. Cover both directions in the tooltip visibility suite.
@kev1n77
kev1n77 merged commit 1ae1abf into GCWing:main Oct 10, 2026
9 checks passed
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