Repository navigation
fix(ui): keep an interactive tooltip preview open while it scrolls - #3339
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep the hover preview of a flow-chat sub-agent card open while the reader scrolls the preview itself. The shared interactive
Tooltipdismissed 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) withoverflow-y: auto, so a long task description has to be scrolled to be read. An open tooltip subscribes to capture-phasescrollon 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 casekeeps an interactive preview open while its own scroll container scrollsscrolls 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 plusnode --test tests/*.test.mjs) -> 326 tests passed, 0 failed.pnpm --dir design-system run test-> the@openbitfun/uipackage and its four tooltip tests pass in that run. The chain still fails inpackages/flow-chat-presentation/tests/catalog.test.tsxon 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.Reviewer Notes
overscroll-behavior: contain, so scrolling it to the end does not chain into the transcript behind it.event.target instanceof Node && surface.contains(event.target), so thevisualViewportscroll path is untouched (its target is not a Node) and the cross-realm fallback still dismisses.Checklist