Repository navigation
[Bug]: Chat loses scroll position when switching tabs inside an inline HTML render #17463
Description
Activity
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Oct 9, 2026 Note
Grok responding on behalf of Julius.
Report: on macOS desktop, switching tabs inside an interactive inline
html_render(sections of different heights) makes the chat jump vertically and lose the reading position. Reporter has a recording; not reproduced by them in a dev build. App version not given.Plausible path on main: a tab change that alters page height reports up to the host, the inline frame resizes, and the virtualized timeline either re-pins to the end (if live-follow is still on) or shifts without browser scroll anchoring.
-
Height report → frame resize
- Injected bootstrap watches the framed document with
ResizeObserverand postsui/notifications/size-changedwith the new content height (bootstrap). HtmlRenderDocumentlistens for that message and callsonContentHeight.HtmlRenderFramefeeds that intohtmlRenderFrameHeightand sets the outer boxstyle={{ height }}(L95, L102).
- Injected bootstrap watches the framed document with
-
Timeline reaction
- While
liveFollowEnabledis on, LegendListmaintainScrollAtEndis active withitemLayout: true(config), so a row height change can re-pin to the end. ChatView documents that this re-pin is independent of the scroll-mode refs (~L6350). - The scroll node sets
[overflow-anchor:none](L1620). With live-follow off, LegendListmaintainVisibleContentPositionhassize: true(L1125-L1131); whether that fully keeps a mid-render reading position when the iframe itself grows or shrinks is unverified here.
- While
-
Clicks inside the iframe and live-follow opt-out
- Opt-out attaches
wheel/touchmove/pointerdownon the timeline scroll node andkeydownondocument(ChatView ~L6547-L6656). - The inline frame is sandboxed (
allow-scripts allow-formsonly) (BrowserDocumentFrame L128). Focus and pointer events inside that document do not bubble to the parent, so a tab click in the render looks unlikely to hithandlePointerDown/handleWheel. - If the reader reached the render without an opt-out the parent saw (same class of gap as #17056), live-follow can remain on; the next height report then re-pins. That is a plausible cause for the jumps in the recording, not a measured reproduction.
- Opt-out attaches
Open PR #17065 (fixes #17056): adds a timeline
scrolllistener pluscreateUpwardScrollDetectorso an upward scroll that chained out of the iframe (with no parentwheel/pointerevent) turns live-follow off. That targets wheel/trackpad scrolling over the frame. A tab click that only changes height inside the iframe and does not move the timeline scroll offset would not fire that detector, so #17065 alone looks unlikely to cover this interaction.Related (not treating as duplicate):
- #17056 — scroll over the iframe fails to stop live-follow; snap on later layout change. Same height/live-follow machinery; different gesture (wheel vs in-frame tab UI).
- #16977 — wheel stuck at the edge of a tall capped render (scroll chaining), not tab-driven height changes.
Ask: app version (or nightly build id) for the recording, and whether the jump lands at the bottom of the thread or only shifts the render in place. That would help tell live-follow re-pin apart from a free-scroll size shift.
-
- addedvia-triageFiled through npx t3 triageFiled through npx t3 triageand removedneeds-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Oct 9, 2026 Thanks — here are the requested details.
App version / nightly build:
0.0.46-nightly.20261009.2861, T3 Code (Nightly) desktop on macOS 26.6.2 (25G83).I checked the installed app bundle (
CFBundleShortVersionStringandCFBundleVersion). The current desktop process started at 15:07 on October 9, before the recording at 17:41, and the installed application files were last modified earlier that morning. This ties the version to the session used for the recording, rather than just quoting an unrelated current nightly.Where the jump lands: visually, it appears to re-anchor to the bottom of the thread, rather than only shifting a render while keeping the same reading position. The HTML render is in the final assistant reply. After tab changes settle, the end of that reply remains just above the composer, while the render heading and tab controls move up/down substantially as the selected section changes height. Switching to the taller sections can move the heading/tab controls out of view; switching back to a shorter section brings earlier content back into view.
This is based on reviewing the existing 8-second recording, not an instrumented reproduction: I cannot give a measured
scrollTop, distance from the end, orliveFollowEnabledvalue from the video. The visible behavior is consistent with an end re-pin, but I have not confirmed the internal cause or tested #17065.The recording is already attached in the issue: https://github.com/user-attachments/assets/7ed10e12-aece-4d14-beab-7150fc640086
Before submitting
Area
apps/web
Steps to reproduce
Reported from the attached 8-second screen recording; not independently reproduced in a dev build.
Expected behavior
The chat should preserve the current reading position when interacting with controls inside an HTML render. Changes to the render’s height should keep the visible content anchored predictably, without jumping to another part of the conversation.
Actual behavior
The chat jumps vertically while switching tabs inside the inline HTML render. Its heading and the surrounding messages move substantially in the viewport, so the current reading position is lost and the user has to scroll back. The jumps are visible repeatedly in the attached recording.
Related: #17056 and #17065 concern scrolling over an HTML iframe and snapping to the end after layout changes. This report captures interaction with tabs inside the render; the underlying cause may be related, but has not been confirmed.
Impact
Minor bug or occasional failure
Version or commit
No response
Environment
macOS, T3 Code desktop app. Recording captured on 2026-10-09; exact OS/app version not recorded.
Logs or stack traces
Screenshots, recordings, or supporting files
t3-html-scroll.mp4
Workaround
Manually scroll back to the desired reading position after the jump.