Repository navigation
fix(composer): reserve the scrollbar gutter under the paste chip mirror - #15511
Conversation
|
Intent: Keep the collapsed paste chip highlight on its token when the composer textarea shows a scrollbar, by making the textarea and its mirror wrap at the same width. |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The composer's text box is now 6px narrower for every draft, short ones included, on classic-scrollbar platforms. A human should confirm that permanent narrowing is acceptable. What this change shipsInventory (5 items) — 5 justifiedIntent: keep a long draft's collapsed-paste highlight on its own token line when the composer shows a scrollbar. This is a FIX (#15510, and a Playwright case that fails on base).
[FIRST-PRINCIPLES-REVIEWED] 9fc409b Description read[DESCRIPTION-READ] 7d81c43072d1342a327174b352fd8f6e01a5ae728c61157e3b030535f5f2c301 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS No first-time reader has looked at the repaired paste chip. The before/after captures show it, and the fix itself looks right. Watch
[UX-REVIEWED] 9fc409b Description read[DESCRIPTION-READ] 824da8397bf612ad4bc8ad15789b24e2f1878780725cf6d60eee5e06df7b6fde That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS The textarea now always keeps a 6px scrollbar gutter, even for a short draft. Check that the narrower text area still looks right next to the composer's controls. [DESIGN-REVIEWED] 9fc409b Description read[DESCRIPTION-READ] 914e6c5417b01366c35cc21fd6da4523ab8388c3f596bc3503393859b2293051 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
4fca8d8 to
c8c3a46
Compare
|
|
self-added: yes
|
|
|
The one red on c8c3a46 is As a fork contributor I cannot re-run jobs. Could a maintainer re-run the failed job in run 36772166017? Every other check and every review lane on this head is green. |
c8c3a46 to
2541672
Compare
2541672 to
9b740e7
Compare
|
Rebased: main moved in |
9b740e7 to
26b40ab
Compare
|
Rebased onto current main with no code change; |
|
note (non-blocking): Frontend Tests shard 4 on |
715af87 to
c8af92a
Compare
|
note (non-blocking): identical-tree retrigger at |
|
note (non-blocking): Integration (in-process gateway) on |
c8af92a to
5251e7f
Compare
|
note (non-blocking): identical-tree retrigger at |
|
note (non-blocking): Integration (in-process gateway) on |
The collapsed-paste chip is painted by a mirror div behind the composer textarea. The mirror never shows a scrollbar, but the textarea draws the 6px classic scrollbar from index.css once the draft overflows. Its text box is then 6px narrower than the mirror's, so a line that ends near the right edge wraps in the textarea and not in the mirror, and every chip after that line is painted one line off its token. Both boxes now set scrollbar-gutter: stable, so they reserve the same gutter and wrap at the same width. A Playwright case launched with visible scrollbars asserts the two boxes have equal client widths while the textarea scrolls (6px apart before this change). The composer's autosize twin in chat-input/sizing.ts copies the textarea's border-box width, which does not show the reserved gutter, so the twin now copies scrollbar-gutter too. Without it the twin wraps 6px wider and can measure a draft one line short, leaving the textarea scrolling below its cap. A second Playwright case asserts the twin and the textarea have equal client widths.
5251e7f to
9fc409b
Compare
|
note (non-blocking): identical-tree retrigger at |
iamwhatever
left a comment
There was a problem hiding this comment.
This fixes the paste chip highlight being painted one line off its token once a long draft shows a classic scrollbar. The root cause is addressed: the textarea's 6px scrollbar narrowed its text box relative to the overflow:hidden mirror, so the two wrapped differently. Both boxes now set [scrollbar-gutter:stable] (ChatInput.tsx, PasteHighlightLayer.tsx), and the autosize twin copies scrollbarGutter in chat-input/sizing.ts, so its height measurement wraps at the same width. The new Playwright spec turns off --hide-scrollbars and guards its preconditions (the scrollbar actually takes width, the draft actually overflows) before asserting zero width gap for the mirror and the twin, so it would fail on main. It also raises MIN_EXECUTED_SPECS by 2. The committed PNGs under temp-screenshots/ come from a fork, which is the allowed path for evidence. The side effect is a permanent 6px empty gutter on classic-scrollbar platforms even for short drafts. The UX lane raises this as a low Watch item on the current head 9fc409b, and it has no current-head disposition yet; the author should answer it, but it is advisory. GPT and Opus are clean, Design and First Principles PASS, and checks are green. — crew-pr-reviewer
|
|
Problem / Motivation
Goal: Keep the collapsed paste chip's highlight on its token when the composer draft is long enough to show a scrollbar.
Once a draft overflows, the chip background is painted one line away from the
[ Paste #N · … ]token: it covers the line above, and the token's own line shows no highlight.Why it matters
Anyone who pastes into a long draft on a platform with classic scrollbars (Chromium on Linux or Windows) sees a floating highlight detached from the text it belongs to. The composer looks broken, and it is unclear which text is the collapsed paste.
Not a goal
What changed (motivation → approach → change)
The chip is painted by a mirror
<div>behind the<textarea>, and the two must wrap text at the same width. When the draft overflows, the textarea draws the 6px scrollbar fromindex.css; the mirror isoverflow: hiddenand never does. The textarea's text box is then 6px narrower, so a line ending near the right edge wraps there and not in the mirror, and every later chip is painted a line off.website/src/components/ChatInput.tsxandwebsite/src/components/PasteHighlightLayer.tsxboth set[scrollbar-gutter:stable]. Each box reserves the same gutter whether or not a scrollbar is drawn, so both wrap at the same width. The textarea's comment inChatInput.tsxsays why the gutter is load-bearing and names the spec that pins it.The composer sizes itself by measuring an off-screen twin textarea (
website/src/components/chat-input/sizing.ts). The twin copies the textarea's border-boxwidth, which does not show a reserved gutter, soscrollbarGutterjoins the copied properties. Without it the twin would wrap 6px wider and could measure a draft one line short, leaving the textarea scrolling below its height cap.Backwards compatibility
Compatible: a CSS class on two elements. No prop, API or stored data changes.
Tests
website/playwright/composer-paste-highlight-scrollbar.spec.tslaunches Chromium with classic scrollbars and holds two cases:clientWidthonce the textarea scrolls. On main they differ by 6px.clientWidthfor a short draft. Without thesizing.tschange they differ by 6px (738 vs 744).test/test_playwright_e2e.py:MIN_EXECUTED_SPECSraised from 239 to 241 for the two new tests; the floor counts executed tests.Manual verification
Ran both paste-highlight spec files (6 tests) against an isolated gateway serving this branch's built dist: all pass. The before/after captures below come from the same rig.
Screenshots / video
Before: the chip background sits on the wrapped line and hides the token.
After: the chip background covers
[ Paste #1 · 8 lines ].Related Issues
Related: #8309
Fixes #15510
Pattern harvest
Not generalizable: the textarea-plus-mirror pair is the only overlay in the app that has to match another box's text wrapping, and #8309 plans to remove it.
Checklist