Skip to content

fix(ui): keep the chat reader's text still while scrolling and while content renders late - #199080

Merged
vyctorbrzezowski merged 14 commits into
openclaw:mainfrom
daniel-lxs:openclaw-chat-jumps-when-scrolling
Nov 15, 2026
Merged

vyctorbrzezowski merged 14 commits into
openclaw:mainfrom
daniel-lxs:openclaw-chat-jumps-when-scrolling

Conversation

@daniel-lxs

@daniel-lxs daniel-lxs commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Fixes #198500

What Problem This Solves

The Control UI chat moves the text being read when settled tool rows enter the viewport during an upward scroll, or when a Mermaid diagram or tool disclosure grows above it. Estimated row heights and painting rows before measurement make the same text appear in one place and then move.

User Impact

The reader's text stays in place while scrolling through tool-heavy history and while content above it renders late, in Chromium and phone-size WebKit.

There is a visible tradeoff: blank frames over 40 px are more frequent. The hold leaves rows unpainted until they are measured. In the real-Gateway VM comparison below, the overall largest blank band and longest blank interval are smaller, even though blank bands occur more often.

Accepted edge cases:

  • At scrollTop 0, native scrolling clamps a negative correction, so the first rows can still shift.
  • A size change during a bubble's 180 ms entry animation is corrected approximately.
  • Near the transcript end, a correction can clamp; end-follow owns that position.
  • Rows whose placement depends on an unmeasured row stay unpainted until that measurement arrives.

Implementation

Production changes stay in the chat transcript code, plus the chat boot JS budget.

  • Rows of unknown size arriving above retained content wait for measurement before joining the flow. Known sizes and revisited rows join directly. An exact estimate is admitted too, even when virtual-core reports no size change.
  • Rows outside the flow paint only where they will land. A measuring predecessor hangs at its real height above the flow. The separate retained-predecessor preparation path is removed.
  • Row landings correct the native scroll offset and redraw the flow in the same frame, including during WebKit scrolling.
  • The reader anchor records visible content in the row crossing the top edge and compensates growth above it. Fallbacks cover a diagram replacing its source block. Content that grows in place keeps marking the reader's place; content that keeps its size defers to what follows it.
  • An expansion control the reader cannot see preserves the reader's content rather than the control's row top. Visible controls keep their row anchored.

Restore, scroll commands, history prepend and end-follow retain their existing positioning ownership.

Changed contracts and budgets

  • fix(ui): stop completed transcripts bouncing during scroll #195097: unknown incoming rows above the reader wait for measurement; known rows still enter directly. The hold also owns the retained predecessor.
  • perf(chat): forecast incoming transcript rows for flings and wheel input #196173: forecast rows are prepared outside the flow and remain unpainted until their placement is known.
  • fix(ui): reduce blank frames during fast transcript scrolling #196001: a measuring predecessor paints at its real height above the flow, rather than at its estimated slot. The regression keeps the checks that it is painted, inert and outside the flow and that retained content does not move.
  • Chat boot JS: chatBootJsGzipBytes increases by 1,333 B gzip, from 1,310,894 B to 1,312,227 B. The measured production tree is 1,311,778 B. The 21 chat boot JS requests against a limit of 20 also occur with main's transcript files.
  • Test lines: the allocation records 142 lines above the 400-line allowance, covering 542 net test lines against the merge base. It covers the reader-stability regressions, the phone-size WebKit flick case and the cold-load restore settle check.

Evidence

Real-Gateway VM comparison

Compared main d3438ec with PR head ea06ca2 in a macOS VM using an isolated real Gateway and saved synthetic sessions containing prose, tables, code and settled tool calls. Chromium uses a 1280×900 viewport with slow and fast upward wheel input. WebKit uses a 390×844 viewport with an iPhone user agent and repeated programmatic momentum steps. This is browser-driven proof, not a physical trackpad or iPhone test.

The sampler tracks the same painted text blocks between frames. The comparison excludes the transcript-start region, where native scroll clamping is an accepted edge case.

Measurement Main d3438ec PR ea06ca2
Chromium worst reverse text movement 206 px 0.5 px
WebKit worst reverse text movement 329 px 0 px
Late Mermaid marker movement 396 px 0 px
Chromium frames with blank bands over 40 px 26/427 45/464
WebKit frames with blank bands over 40 px 1 17
Overall largest blank band 758 px 537 px
Overall longest observed blank interval 434 ms 384 ms

Jumps are eliminated in this comparison, but blank frames over 40 px are more frequent in both browsers. The overall maximum band is 537 px versus main's 758 px, and the longest observed interval is 384 ms versus 434 ms. The hold deliberately leaves rows unpainted until measured, trading more frequent blank bands for stable text. The size and duration comparison is for the overall maxima, not a claim that each browser's blank bands shrink.

Visual examples

These captures illustrate the reader-stability change. The exact-head VM measurements are in the table above.

Main during fast upward scrolling: the same line moves up about 206 px against the scroll.

Main, fast upward scroll: before and after frames, the same line moves up 206 px

With the reader-stability change, the same line stays at y=178 px.

Reader-stability change, fast upward scroll: before and after frames, the same line stays at y=178 px

Mermaid with synthetic content:

Before render Main after render With the reader-stability change
Reader marker below a Mermaid source block The rendered diagram pushes the reader marker down The reader marker stays in place after the diagram renders

Regression coverage and validation

  • The committed scroll test checks every visible text block between painted frames in Chromium and phone-size WebKit, including cut content and rows painted outside the flow. The phone-size WebKit case fails at 65 px without the fix.
  • The late-content e2e fails on main at 396 px and passes with the fix. The top-row anchor browser tests cover growth above and below the reader, scrolling, and the transcript start.
  • The cold-load restore test waits for rows brought in by a wheel step to join the flow before recording its reader. Its restore assertion is unchanged. The projected-reply fixture delivers the native row measurement before checking the deferred highlight; its highlight assertion is unchanged.
  • Recorded passing e2e coverage: scroll tool rows (2), reading stability (3), history prepend (14), late content (1), cold load (3), disclosure anchor (7), scroll (2), scroll dock (3).
  • Recorded passing browser coverage: end-follow (31), geometry updates (32), reader anchor (7), reader content (5), disclosure (7). Transcript unit coverage: 130 passing tests.
  • Existing flakes also reproduce with main's transcript files: raw-tool disclosure anchoring fails in 3/6 full-file runs with main and 2/9 with the PR; shrinking-end-target smooth scrolling fails in 1/6 with main and 2/6 with the PR.
  • Typecheck (tsconfig.ui.json), oxlint and oxfmt pass. The document, largest CSS, largest JS and total CSS budget reports match main's transcript files. Full exact-head CI is tracked by this PR's checks; these local results do not replace it.

…op visible chat row

A page-preview card that loads its screenshot late inside a message already
on screen pushed the text the reader was looking at down by the image height.
The transcript disables native scroll anchoring, and the reader anchor only
compensated rows entirely above the viewport.

The reader anchor now records the first content at or below the viewport's
top edge inside the row crossing it, after each native scroll and resize
delivery, and corrects growth above that content the same way row
corrections are applied. Virtual-core's later landing of that row skips the
already-applied growth, a scroll event before the resize delivery keeps the
earlier record, and the record is refreshed when entering-bubble animations
end.
…ow its row

A Mermaid diagram rendering late inside the message at the viewport's top
edge moved the reader's text by the diagram height, and the in-row scroll
correction ran before virtual-core knew the row had grown, so the range
dropped the reader's row. A disclosure opened through a control the reader
cannot see kept that control's row top in place, pushing the visible text
below it down.

The reader anchor now selects content like native scroll anchoring: it walks
into the content the top edge cuts and anchors on the first content starting
at or below it, with the content after each ancestor as fallbacks when a
rendered replacement detaches the first. In-row corrections go through the
existing row correction path, so virtual offsets follow the scroll and the
landed size owes no further scroll. A capture after a resize delivery no
longer keeps a record from before a change already laid out.

The interaction anchor keeps a visible control's row in place as before; for
a control the reader cannot see, it keeps the reader's recorded content in
place instead, and still suppresses end-follow while it settles.

The late browser-preview e2e is replaced by a Mermaid e2e: automatic browser
preview cards were removed in openclaw#197549.
Scrolling up, a row prepared outside the flow joins it together with newly
mounted rows. The reader anchor treated any measured row as retained
content, so the prepared row became the retained one and a new row mounted
after it, between it and the text the reader sees, was not compensated: its
estimate error (240 px estimated, about 34 px rendered for a settled tool
row) moved the visible text against the scroll.

Retained content is now the rows laid out in the flow at the last resize
delivery.
…asured

Rows scrolled into view above laid-out content entered the flow at their real
size while the flow's start still counted their estimate, so a fast upward
scroll through settled tool rows (estimated 240 px, rendered ~34 px) moved the
text being read against the scroll.

Such rows now stay prepared, painted at their slot, until all of them are
measured. Their landing corrects scrollTop in the same frame, written by the
reader anchor rather than deferred by virtual-core on iOS, and the flow redraws
in that frame. A row measuring exactly its estimate is admitted too.
Partly visible text still moved during fast upward scrolls:

- Rows arriving inside the viewport, and the forecast rows prepared ahead of a
  wheel, were painted at their estimated slot (120 or 240 px), clipped, and
  then moved by hundreds of pixels when they joined the flow.
- In a batch of landings, the last row could see no laid-out content because
  earlier landings had moved virtual-core's range. Its size change then went
  uncorrected (about 23 px).

A row outside the flow now paints only once its size and those of the rows
between it and the flow are known; until then it stays unpainted. The reader
anchor finds the flow among the mounted rows rather than in the virtual range.
Arriving rows whose size virtual-core already knows enter the flow directly,
which removes the extra commit on return scrolls.

The scroll regression test now uses a mixed agent session and checks every
visible text block, including partly visible ones. The two forecast tests
from openclaw#196173 now expect unmeasured forecast rows to stay unpainted.
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Nov 14, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR coordinates transcript measurement, row admission, and content anchoring to keep the reader’s text steady.

Example: Scroll upward through a saved session containing settled tool calls.

  • Before: The supplied Chromium comparison shows text reversing upward by 206 px.
  • After: The reported exact-head comparison limits reverse movement to 0.5 px, while blank bands occur more frequently.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Credible visual proof and no discrete introduced defect, with readiness limited by the unresolved owner tradeoff and unexecuted required CI.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected scrolling and Mermaid screenshots substantiate the changed transcript behavior, supplemented by the body’s exact-head isolated real-Gateway Chromium and phone-size WebKit results; the declared WebKit scenario uses programmatic steps and makes no physical-iPhone claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Text jumps against upward scrolling or moves when diagrams and disclosures grow above the reader.
Reason: The stability improvement has clear value, but deliberately withholding forecast paint changes an established coverage tradeoff, and neither that regression nor the increased byte ceiling has recorded owner acceptance.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR addresses a verified upstream scrolling bug, and the previous allocation finding is fixed; the disclosed blank-frame tradeoff and increased byte budget still need an owner decision.

Priority: P2
Reviewed head: ea06ca211d4e1eb6e20e14626b1c67f968f22471
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the UI accept more frequent blank bands and a 1,333 B higher chat boot ceiling in exchange for the demonstrated reader stability?
  • Recommendation: Preserve the existing coverage target: Request revised admission behavior that keeps text steady without increasing blank-band frequency; the late-content anchor can be separated if needed.
  • Why: The contributor discloses the tradeoff, but the recorded maintainer direction requested no increased blanking and does not approve the new byte ceiling.

Before merge

  • Await maintainer action - A maintainer must authorize the exact-head GitHub Actions runs so required CI can execute.

Findings

None.

Agent review details

How this fits together

The Control UI transcript turns session messages into virtual rows; its existing presentation and geometry owners coordinate browser measurements, row placement, and scroll corrections.

flowchart TD
  A[Session messages] --> B[Virtualizer host]
  B --> C[Initial range and forecast]
  C --> D[Solid transcript rows]
  D --> E[Browser measurements]
  E --> F[Reader anchor]
  F --> B
Loading

Technical review

Best possible solution:

Use the existing anchoring owners to eliminate reverse jumps without increasing blank-frame frequency, splitting the late-content repair if necessary.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes both estimated-row admission and missing in-row compensation, supported by the supplied real-Gateway measurements and inspected before/after images; this review executed no reproduction.

Is this the best way to solve the issue?

The repair appropriately extends existing owners and removes the separate predecessor path, but its broader admission policy needs the UI owner’s judgment on the measured blanking cost.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e6a222e1621a.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit cf376b0 adds ui/src/pages/chat/components/chat-transcript-initial-range.ts:154 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cf376b0d000a; files: ui/src/pages/chat/components/chat-transcript-initial-range.ts)
  • Vyctor H. Brzezowski: Raw commit b977ccb adds ui/src/pages/chat/components/chat-transcript-interaction-anchor.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b977ccb21e2b; files: ui/src/pages/chat/components/chat-transcript-interaction-anchor.ts)

PR surface

Source +325, Tests +542, Other +3. Total +870 across 17 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 7 395 70 +325
Tests 8 557 15 +542
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 1 +3
Total 17 956 86 +870

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus tests Production +397/-71; tests +557/-15 Production growth extends existing geometry owners; regression growth covers cross-browser scrolling, native resize ordering, and late-content placement.
Chat boot gzip ceiling 1,310,894 → 1,312,227 B The enforced ceiling increases by 1,333 B and needs owner acceptance.

Root-cause cluster

Relationship: same_root_cause
Canonical: #198500
Summary: This PR repairs the reported incoming-row and late-content movement; the merged prepend-measurement repair addresses a separate trigger.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add merge-risk: 🚨 other: The admission policy deliberately increases visible blank-band frequency while improving text stability.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: Reading long tool-heavy transcripts is disrupted, but the application remains usable.
  • merge-risk: 🚨 other: The admission policy deliberately increases visible blank-band frequency while improving text stability.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-14T18:59:14.993Z sha fe5e59c :: blocked before merge. :: [P2] Allocate the regression tests exceeding the test-line allowance
  • reviewed 2026-11-14T19:15:30.655Z sha 43bde35 :: blocked before merge. :: none
  • reviewed 2026-11-14T20:32:04.975Z sha ba89b88 :: blocked before merge. :: none
  • reviewed 2026-11-15T02:52:51.867Z sha 6c0c9fe :: needs real behavior proof before merge. :: [P2] [P2] Cover the additional 60 test lines in the allocation

Reviewed November 15, 2026, 12:33 AM ET / 05:33 UTC (Revision 5).

@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper clawsweeper Bot added the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Nov 15, 2026
The strict scroll e2e's phone-size WebKit flick case and the cold-load restore check's settle wait add 60 net test lines; the allocation covers them (542 net lines against the merge base).
@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 15, 2026

@vyctorbrzezowski vyctorbrzezowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the updated scrolling implementation and the published before/after evidence. I accept the documented tradeoff: more frequent transient blank bands in exchange for keeping the reader's text stable.

I fixed the CI setup omission: the new scroll regression now selects WebKit installation. On Tempbook, both unchanged browser cases pass (Chromium and phone-size WebKit). The exact CI discovery code selects no WebKit before the fix and selects it afterward. Workflow lint/security checks and formatting also pass; independent review found no additional actionable issues.

The real-Gateway and iOS Simulator runs remain the contributor's evidence; my fresh execution was the automated browser regression. No production changes were added in this pass.

Thanks @daniel-lxs for addressing the findings and documenting both the improvement and its limits.

@vyctorbrzezowski
vyctorbrzezowski merged commit 97dd78c into openclaw:main Nov 15, 2026
85 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
…content renders late (openclaw#199080)

Keep the reader's text stable as measured rows enter the flow and content renders late. Register the mixed-row regression for WebKit installation in CI.

Validated with Chromium and phone-size WebKit regressions, workflow checks, and independent review. The documented transient-blanking tradeoff is accepted.

Co-authored-by: Daniel <[email protected]>
Co-authored-by: Vyctor H. Brzezowski <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: Vyctor H. Brzezowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control UI chat: the text being read jumps while scrolling up through tool calls

3 participants