Skip to content

fix(web): dismiss chat tooltips when scrolling - #7768

Open
Ic3b3rg wants to merge 5 commits into
pingdotgg:mainfrom
Ic3b3rg:fix/chat-tooltip-scroll-dismiss
Open

fix(web): dismiss chat tooltips when scrolling#7768
Ic3b3rg wants to merge 5 commits into
pingdotgg:mainfrom
Ic3b3rg:fix/chat-tooltip-scroll-dismiss

Conversation

@Ic3b3rg

@Ic3b3rg Ic3b3rg commented Aug 21, 2026

Copy link
Copy Markdown

What Changed

  • Dismiss hover-opened tooltips when the chat timeline scrolls, including delayed hover opens that have not rendered yet.
  • Preserve tooltips opened from keyboard focus while the timeline moves.
  • Keep timeline tooltips on their existing layer so they remain above chat chrome.
  • Add focused coverage for tooltip stacking, one-shot dismissal, focus preservation, and timeline scoping.

Why

Scrolling moves message content without necessarily moving the pointer or emitting a mouseleave event. A tooltip could therefore remain open after its trigger had moved away, and its portal layer could paint over the composer.

The timeline now tracks only the current hover tooltip through a stable callback-only context. Scroll handling performs an O(1) lookup and imperative close without updating React state or context, avoiding a render fan-out on the scroll path.

Closes #7767.

UI Changes

Before: A tooltip opened over a message could remain visible while scrolling and overlap the composer.

After: Hover-opened timeline tooltips close on the first scroll event. Keyboard-focused tooltips remain available, and timeline tooltips retain their existing stacking above chat chrome.

A recording of the scroll interaction is attached below. Before/after screenshots are still outstanding, so the PR remains a draft.

Registrazione.schermo.2026-08-21.alle.10.38.03.mov

Testing

  • cd apps/web && pnpm exec vp test run src/components/ui/tooltip.test.tsx src/components/chat/MessagesTimeline.test.tsx --project unit — 33 passed
  • cd apps/web && pnpm run typecheck — passed
  • Targeted lint for the five changed files — passed
  • Targeted format check for the five changed files — passed
  • cd apps/web && pnpm exec vp build — passed

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for the UI changes
  • I included a video for the scroll interaction change

Implemented with GPT-5.6 Sol in the Codex harness via T3 Code.


Note

Low Risk
UI-only tooltip hover tracking and scroll close; no auth or data-path changes. TooltipTrigger now composes mouse handlers under the new provider.

Overview
Hover-opened tooltips in the chat timeline now close on scroll so they don’t stay parked over the composer after the trigger has moved.

MessagesTimeline wraps the list in TooltipScrollDismissProvider and calls dismissHoveredTooltip() from onScroll. Dismissal is O(1) and imperative (no React state on the scroll path). Tooltips whose trigger (or a descendant) still has focus stay open.

Outside the provider, Tooltip / TooltipTrigger behave as before. Tests cover one-shot dismiss, focus preservation, stacking (z-[140]), and that the timeline opts into the provider.

Reviewed by Cursor Bugbot for commit 55de62b. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Dismiss hovered chat tooltips on scroll in MessagesTimeline

  • Adds TooltipScrollDismissProvider context and createTooltipScrollDismissController so scroll handlers can programmatically close the currently hovered tooltip while preserving tooltips whose trigger or descendant has focus.
  • MessagesTimeline wraps its timeline in the provider and calls controller.dismissHoveredTooltip() at the start of handleScroll before updating scroll state.
  • Tooltip and TooltipTrigger participate only when rendered under the provider; outside it, behavior is unchanged.
  • Risk: TooltipTrigger now wraps onMouseEnter/onMouseLeave when inside a provider — verify any existing consumer-supplied handlers still fire correctly via tooltip.tsx.

Macroscope summarized 55de62b.

Close hover-opened timeline tooltips when their trigger moves away under a stationary pointer. Preserve keyboard-focused tooltips and keep timeline tooltip portals below the composer.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 824435cf-d89e-4a8f-b977-00e02ee1d840

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 21, 2026
Comment thread apps/web/src/components/ui/tooltip.tsx

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

UI consistency review: one layering issue found in the new tooltip content layer. The scroll-dismiss controller itself (tooltipScrollDismiss.ts) and the TooltipLayerProvider wiring in MessagesTimeline look consistent with the shared primitive contract; the concern is the z-index value chosen for the new layer.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/ui/tooltip.tsx Outdated
Treat focus on descendants of a rendered tooltip trigger as focus within the trigger so scrolling does not dismiss keyboard-accessible tooltips.
Comment thread apps/web/src/components/ui/tooltipScrollDismiss.ts
Remove the content-specific tooltip layer so scroll dismissal does not place timeline tooltips behind minimaps and floating controls. Keep the scroll path on a stable callback-only context.
Keep the hovered tooltip reference while focus remains within its trigger so a later scroll can dismiss it after focus moves away.
@Ic3b3rg
Ic3b3rg marked this pull request as ready for review August 21, 2026 09:40
@macroscopeapp

macroscopeapp Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5376f96

Macroscope's review found this PR approvable — Self-contained UI fix that dismisses tooltips when scrolling in the chat timeline. The implementation adds a simple tracking controller with proper React context integration and comprehensive test coverage. Low-risk, narrow scope change.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chat tooltips remain visible over the composer while scrolling

1 participant