Skip to content

fix(native-chat): stop following the end when the reader scrolls over a visual - #29116

Merged
AmoabaKelvin merged 8 commits into
stablyai:mainfrom
AmoabaKelvin:stop-following-on-visual-scroll
Oct 16, 2026
Merged

AmoabaKelvin merged 8 commits into
stablyai:mainfrom
AmoabaKelvin:stop-following-on-visual-scroll

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​435 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​432
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​141 $\color{#cf222e}{\Huge{\mathbf{−}}}$​47 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94

ELI5

When an agent reply includes a chart or another HTML visual, scrolling up with the mouse over that visual kept snapping the chat back to the bottom. The chat now notices that scroll like any other and stays where you put it.

What Changed

Before: with the pointer over an inline visual, the mouse wheel moved the transcript, but the transcript still believed the reader was at the end. The next time anything changed height (streamed text, the visual reporting its size, a row expanding) it scrolled back to the bottom, and the "Jump to latest" button never appeared. Large visuals made this almost certain, because they fill the viewport and the pointer is nearly always over them.

After: scrolling up over a visual detaches the view the same way scrolling over the text does. The jump button appears and the transcript stays put until the reader returns to the end.

Mechanism: the visual runs in a sandboxed iframe. Chromium gives the wheel event to the frame's document and chains the leftover scroll to the transcript at the compositor level, so the transcript scrolls without ever receiving a wheel event. The follow logic only lets go of the end on a reader gesture, so it never let go. The frame's bootstrap script now listens for wheel and touchmove, and when nothing inside the page can scroll in that direction it posts a message to the host. The host feeds that into the same path the message rail already uses for the wheel it forwards.

Why

The follow logic deliberately ignores scroll events and only trusts gestures, because layout and the virtualizer produce scroll events of their own. Teaching it to treat unexplained scrolls as the reader would undo that design. Forwarding the gesture from the one surface that swallows it keeps the model intact and reuses the rail's path. The shell reports only a wheel the page cannot consume, mirroring the transcript's rule for nested scrollers, so a visual taller than the 2000px frame cap keeps its own internal scroll until it hits an edge.

Mobile builds the same shell document and will receive the new message; its frame ignores kinds it does not handle.

Linked Issue

No dedicated issue. Related: #23797.

Visual Proof

N/A: no visual change. The cause was confirmed with a headless Chromium probe: a wheel over an iframe inside a scroller moved the scroller with no wheel event on the parent document, until the iframe scrolled out from under the pointer.

Testing

  • The frame's bootstrap script runs for real in a fresh happy-dom window: it reports only when nothing in the page can scroll that way, treats a page taller than the frame as its own scroller, ignores zoom, zero and contained wheels, and reports a touch drag.

  • The frame, the reader-input hook and the inline visual wiring each have a test for the new path.

  • Typecheck, full lint and the native-chat suites pass locally on macOS. Not exercised in the running app.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

The chained scroll event reaches the host a frame before the frame's message does. Following is still true for that one event, then drops when the message lands. Worth a close look at scrollsWithin in the shell script and at the ordering in use-native-chat-transcript-scroll.ts.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

… a visual

A wheel over a visual's frame scrolls the transcript without ever reaching
it as a wheel event, so the view snapped back to the bottom on the next
content change.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 839477b6-5c2f-4a28-b217-2dd9e065069c
📥 Commits

Reviewing files that changed from the base of the PR and between a546dab and f0e756a.

📒 Files selected for processing: 2
  • src/shared/native-chat-visual-shell.reader-scroll.test.ts
  • src/shared/native-chat-visual-shell.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The visual shell now reports eligible wheel and touch input through reader-scroll messages. The renderer validates those messages and forwards them through native chat components to the reader-scroll handler. The handler reports the gestures and updates leave-end behavior. Tests cover shell reporting, frame handling, and transcript scroll position. The mobile frame now processes link URLs only for open-link messages.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to f0e75

Touching or scrolling inside an inline visual can interrupt transcript navigation before the visual reaches its scroll edge. Fix touch forwarding before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description covers the user impact, mechanism, rationale, testing, visual proof, and checklist. However, the required linked issue is missing: it states “No dedicated issue. Related: #23797” inste… Add the actual issue reference under Linked Issue, preferably using the required Fixes #<issue-number> format. Confirm that the referenced issue directly tracks this change.
Passed Passed checks: 3 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: preventing native chat from continuing to follow the end when the reader scrolls over a visual.
Full details: Description check

Explanation

The description covers the user impact, mechanism, rationale, testing, visual proof, and checklist. However, the required linked issue is missing: it states “No dedicated issue. Related: #23797” instead of linking an issue with the required Fixes reference.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e91f10f4-21bd-4038-9fa5-6a1ba6e872c0
📥 Commits

Reviewing files that changed from the base of the PR and between 6ade7a5 and 178cdda.

📒 Files selected for processing: 11
  • src/renderer/src/components/native-chat/NativeChatInlineVisual.reader-scroll.test.tsx
  • src/renderer/src/components/native-chat/NativeChatInlineVisual.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
  • src/renderer/src/components/native-chat/NativeChatTranscriptItems.tsx
  • src/renderer/src/components/native-chat/NativeChatVisualFrame.test.tsx
  • src/renderer/src/components/native-chat/NativeChatVisualFrame.tsx
  • src/renderer/src/components/native-chat/native-chat-reader-scroll-input.test.tsx
  • src/renderer/src/components/native-chat/native-chat-reader-scroll-input.ts
  • src/shared/native-chat-visual-shell.reader-scroll.test.ts
  • src/shared/native-chat-visual-shell.test.ts
  • src/shared/native-chat-visual-shell.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment thread src/shared/native-chat-visual-shell.ts Resolved
Comment thread src/shared/native-chat-visual-shell.ts Resolved
Heard at the window after the page's handlers, so a chart's own wheel zoom
no longer reads as the reader leaving the end.
…he composed path

A chart that cancels the wheel from a window listener does so after the
shell's own; scrollers inside shadow roots are hidden from the retargeted
target; an overflow:hidden root chains to the transcript whatever offset it
holds. Chromium confirmed all three.
@AmoabaKelvin
AmoabaKelvin force-pushed the stop-following-on-visual-scroll branch from 91e8ec6 to f0b368e Compare October 15, 2026 10:12
…bubbling

The transcript scrolls for that wheel all the same. Also drops the inline
visual scroll test; the transcript-level test covers the same wiring.
@AmoabaKelvin
AmoabaKelvin force-pushed the stop-following-on-visual-scroll branch from abbe778 to a546dab Compare October 15, 2026 21:40
Iframe reports arrive asynchronously and can describe scrolling
contained inside a visual.
@AmoabaKelvin
AmoabaKelvin merged commit 4446d4f into stablyai:main Oct 16, 2026
33 checks passed
@AmoabaKelvin
AmoabaKelvin deleted the stop-following-on-visual-scroll branch October 16, 2026 18:11
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