Files
deepseek-harness/apps/web/tests/snapshots/composer-draft-scroll/geometry.expected.md
creatixchu f8ef2cf36b fix(web): give the backdrop the trailing-line sentinel so the layers share one extent
Review caught a real divergence the earlier measurements missed: mirroring
an offset is only correct while both layers can reach it, and for a draft
ending in a newline the backdrop could not.

A textarea reserves a line box for the caret after a final newline.
`white-space: pre-wrap` collapses a text node's trailing newline and
generates none. So a draft ending in a newline made the backdrop exactly one
line shorter than the textarea — measured 628 against 652 — and the mirrored
assignment clamped, leaving the glyphs one line behind the caret at the very
bottom of the draft.

The backdrop now carries the same trailing-line sentinel the mirror div has
carried all along: its content is the decoration walk plus one newline. The
same pre-wrap collapse absorbs it when the draft does not end in a newline,
so it costs no height in the ordinary case, and it supplies the missing line
box when it does. Verified in isolation first: a bare pre-wrap div measures
180/180/198 against a textarea's 180/198/216 for zero, one and two trailing
newlines, and 180/198/216 with the sentinel.

Coverage for the shape that exposed it: the browser scenario asserts the two
extents are equal before asserting the glyphs reach the end, observing each
layer's maximum by asking for an impossible offset and reading back the
clamp rather than computing it from scrollHeight, and the golden records the
relation. The unit spec pins the backdrop's text as the draft plus exactly
one newline. Removing the sentinel fails both, the e2e with the same 628
against 652.

The scrollbar-gutter half of the same review point does not reproduce here:
both layers measure clientWidth 776 against a border box of 776 while the
draft overflows, so this engine's textarea scrollbar is an overlay and takes
no width out of the wrap.
2026-07-31 12:12:54 +08:00

674 B

Composer draft scrolling (14-line cap, two text layers)

At the start of the draft

  • draft overflows the capped box: true
  • visible lines: 14
  • both layers share one scroll extent: true
  • textarea scroll offset: 0px
  • glyph layer tracks it: true
  • first draft line is on screen: true
  • last draft line is on screen: false

Scrolled to the end of the draft

  • textarea moved: true
  • glyph layer tracks it: true
  • first draft line has scrolled out above: true
  • last draft line is on screen: true

Draft ending in a newline, scrolled to the end

  • both layers share one scroll extent: true
  • glyph layer tracks the caret: true
  • last draft line is on screen: true