Skip to content

fix: stabilize chat scrolling and dark text selection - #70

Merged
ezdemo merged 11 commits into
mainfrom
devin/1795748400-fix-chat-virtual-scroll
Nov 27, 2026
Merged

ezdemo merged 11 commits into
mainfrom
devin/1795748400-fix-chat-virtual-scroll

Conversation

@ezdemo

@ezdemo ezdemo commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Keep completed replies pinned to the newest message when the authoritative history reload folds streamed approval loops into fewer/larger turns. The follow-up scroll now runs in useLayoutEffect, and real message-layout changes can request a one-frame bottom pin without treating viewport-only scrolling as a layout change.
  • Stabilize long virtualized conversations with content-aware estimates for unmounted rows (estimateMessageHeight): tall numbered/code-like answers are tall before mounting, ordinary rows remain close to the legacy scale, attachment/context envelopes count only as compact controls, and measured rows correct their own positions without inflating every hidden row.
  • Preserve intentional scrolling: small upward wheel movement marks the reader as away, while browser clamping after content shrink can resume follow when it lands exactly at the bottom. Programmatic correction events are ignored by the user-scroll heuristic on desktop and mobile.
  • Keep the row overlapping the viewport anchored while measurements replace the mounted virtual window. Native browser scroll anchoring remains enabled for short conversations (for example collapse-all) and is disabled only while the virtualized list owns correction.
  • Repin a reader who was already at the bottom when approval forms or composer growth shrink the scroller viewport; readers browsing history stay in place.
  • Restore a clearly visible inverted dark text selection (#d4d4d4 on #111111) after the neutral theme refresh regressed it to a near-surface gray; a contrast regression test covers the dark selection tokens.

Validation:

  • web pnpm build passed.
  • mobile pnpm build passed.
  • mobile pnpm test passed: 30/30.
  • Targeted scroll/window tests passed: 35/35.
  • End-to-end UI verification passed on the real Go backend + React web UI with live model generation; evidence is in the PR comment below. Covered completion reload, long virtualized scrolling, bottom dragging, ask_choice viewport shrink, collapse-all, and dark text selection. Packaged native desktop shell was not tested.
  • Focused real-browser spacer retest passed after the content-aware estimator: scrollHeight stayed stable across a long-session switch (34028 → 34246, about 0.6%) instead of inflating into the prior 74k–89k range.

Link to Devin session: https://app.devin.ai/sessions/77033b0859bc4138958b7c9100ec1d5f
Open in Devin Desktop: https://app.devin.ai/desktop/session/77033b0859bc4138958b7c9100ec1d5f?variant=devin
Requested by: @ezdemo


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

Keep completed replies pinned to the bottom while authoritative history reloads collapse streamed turns, and preserve the visible anchor when virtualized message measurements correct spacer heights.

Use measured per-role heights for unmounted virtual rows, suppress programmatic correction scroll events, disable conflicting browser scroll anchoring, and restore a high-contrast inverted text selection in the dark theme.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

Do not repin the transcript for viewport-only virtual-list renders, and distinguish an exact bottom clamp from a deliberate small upward scroll near the bottom.
Track the row overlapping the viewport and, when measurement moves it outside the mounted window, correct against its represented virtual position instead of requiring an overlapping row.
Only disable browser scroll anchoring while the virtualized message list owns correction, so collapsing blocks in short conversations can still preserve the visible message.
Observe the scroller size for short and virtualized sessions so approval forms or composer growth can keep an already bottom-pinned reader at the latest message.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor
End-to-end UI verification on head 17f9fdb

Tested the real Go backend + React web UI with live GLM generation and seeded adversarial sessions.

  • ✅ Completion/history reload stayed on the newest message in a long virtualized conversation.
  • ✅ Slow upward scrolling through mixed short/medium/very-long rows did not pull the reader back to bottom or jump to an unrelated earlier turn.
  • ✅ Scrollbar dragging near bottom reached the latest message.
  • ✅ A live ask_choice popup shrank the viewport from 673px to 498px while the bottom reader stayed pinned to the latest row.
  • ✅ Collapse-all in a short conversation corrected scrollTop from 1126 to 136 while keeping marker A4 at the same viewport position, y≈586.
  • ✅ Dark-theme selection is light-background/dark-text and clearly readable.

UI verification recording

Completion stayed at newest message

Question popup remained pinned

Collapse-all and dark-selection evidence

Expanded block before collapse-all

Visible message preserved after collapse-all

Dark theme text selection

Notes: the first ask_choice generation attempt inside the extremely long-response session sat in model preparation for 40+ seconds and was stopped; the popup behavior was verified live in a separate 70-row virtualized session. This verification covered the browser web UI, not a packaged native desktop shell.

Devin session: https://app.devin.ai/sessions/77033b0859bc4138958b7c9100ec1d5f

@devin-ai-integration

Copy link
Copy Markdown
Contributor
Focused virtual-spacer retest at 241d3d7 — passed

Tested the real Go backend + rebuilt React web UI. PR70 stream fix stabilized before switching sessions:

scrollHeight=34028
scrollTop=33355
clientHeight=673
dist=0
mounted rows=1: history-165
top spacer=28130
bottom spacer=absent/0

After switching to the other long session and back, then waiting 5+ seconds:

scrollHeight=34246
scrollTop=33573.5
clientHeight=673
dist=-0.5
mounted rows=1: history-165
top spacer=28349
bottom spacer=absent/0

Comparison: 34028 → 34246 (+218, about 0.6%). The earlier inflation toward 74k–89k is gone in this focused retest.

Before switching

After switching back

Written by Devin

@ezdemo
ezdemo merged commit af07523 into main Nov 27, 2026
9 checks passed
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