Repository navigation
fix(ui): stop Files-tab preview blowing past the panel clip (#2666) - #2681
Conversation
Previewing a text file containing one unbreakable token — a long path, a URL, a base64 blob, a run of `===` — grew the whole preview pane far past the visible area. The panel root is `overflow-hidden` and nothing in the chain scrolls horizontally, so the overflow was unreachable: every line was cut off at the right edge with no scrollbar to drag. Because the `<pre>` is `whitespace-pre-wrap`, ordinary prose then wrapped at the blown-out width too, so the whole preview was clipped, not just the token. Two classes, each fixing a different half: - `FilesPanel.vue` — `min-w-0` on the preview column. As a flex item at the default `min-width: auto` it could not shrink below the min-content width of its contents, which the token defined. - `FilePreview.vue` — `break-words` on the `<pre>`. Wrap rather than horizontal scroll, deliberately: it matches the in-repo precedent `PortalFilePreview.vue`, it is what the design-system contract asks for (bounded viewport, unbounded data), and a scrollbar on a `<pre>` that can be 80 KB tall sits below the fold and is effectively unreachable. Measured in Chromium at a 1280px viewport on a file holding one 320-char unbreakable token, reading scrollWidth/clientWidth: neither root 3048/1280 pane 2768 pre 2720 sidebar 280px break-words only root 3048/1280 pane 2768 pre 2720 sidebar 280px min-w-0 only root 1280/1280 pane 960 pre 2720/912 both root 1280/1280 pane 960 pre 912/912 sidebar 320px `break-words` alone changes nothing — with `min-width: auto` the pane still sizes to min-content, which a break-word rule does not reduce. `min-w-0` alone stops the pane growing but leaves the token overflowing into the `<pre>`'s own `overflow-auto`, i.e. the below-the-fold scrollbar. The sidebar column shrinking 320px → 280px in the broken states is the layout-stability half of the report. Edit mode (the `<textarea>` branch) never blew out — a textarea's width is not content-derived and Chrome's UA sheet already gives it `overflow-wrap: break-word` — and is measured here to confirm it. vitest runs `environment: 'node'` with no mount harness, and even a DOM harness computes no layout, so the browser measurement cannot live in CI. `tests/unit/filesPanelPreviewClip.spec.js` is the source-structure guard for it (the `agentDetailDeepLink.spec.js` shape): it pins both classes, pins that the root still clips — the premise that makes `min-w-0` necessary — and pins the `PortalFilePreview.vue` precedent so the two surfaces cannot silently disagree about wrap-vs-scroll. Each assertion was proven load-bearing by reverting its class and watching it fail. Related to #2666 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RSjVEjay9ztC1oDXXkh9uN
|
merge-train 2026-09-10: on this train. No commits pushed to your branch — it was already current with The fix is real and I verified it independently rather than reading the diff. I reproduced your whole measurement table in Chromium and it matches exactly — no fix: root 3048/1280, col 2768, pre 2720, sidebar 280px; with both classes: 1280/1280, 960, 912/912, sidebar 320px. AC 4 (edit-mode Two findings, both needing your call: 1. The guard the issue asked for was substituted, and the stated reason doesn't hold. #2666's Technical Notes asked for "an e2e assertion that the panel root's What the shipped guard actually asserts: It cannot fail if Tailwind stops emitting 2. A sibling input of the same class is still broken, and the new guard can't see it. With both your classes applied, a file whose name/path carries a long unbreakable token still blows the panel root out, with no scrollbar anywhere:
Not a regression — pre-PR was equally broken — so a follow-up issue is a legitimate disposition, and AC 1 is simply written more broadly than what shipped. I did not touch either, since both are your design calls, not mechanical repairs. |
Fixes the Files-tab preview clip reported in #2666.
The bug
Previewing a text file containing one unbreakable token — a long path, a URL, a base64 blob, a run of
===— grew the whole preview pane far past the visible area. The panel root isflex h-[calc(100vh-220px)] overflow-hiddenand nothing in the chain scrolls horizontally, so the overflow was unreachable: every line cut off at the right edge, no scrollbar to drag. And because the<pre>iswhitespace-pre-wrap, ordinary prose then wrapped at the blown-out width too — so the whole preview was clipped, not just the token.The fix — two classes, each fixing a different half
FilesPanel.vue—min-w-0on the preview column. As a flex item at the defaultmin-width: autoit could not shrink below the min-content width of its contents, which the token defined.FilePreview.vue—break-wordson the<pre>.Wrap, not horizontal scroll — deliberately. The issue left this open. Wrap wins on three grounds: it matches the in-repo precedent
PortalFilePreview.vue(samewhitespace-pre-wrap break-wordsinside amin-w-0chain, and it has never shown this); it is what the design-system contract asks for (bounded viewport, unbounded data); and a horizontal scrollbar here would sit at the bottom of a<pre>that can be 80 KB tall — below the fold, so unreachable for exactly the files that need it.Measured, not asserted
Chromium at a 1280px viewport, real components mounted with a stubbed store, previewing a file whose content holds one 320-char unbreakable token. Reading
scrollWidth/clientWidth:<pre>break-wordsonlymin-w-0onlydocumentElementwas 1280/1280 throughout — i.e. no page scrollbar either, matching the report.Each class is proven load-bearing by that table.
break-wordsalone changes nothing: withmin-width: autothe pane still sizes to min-content, which a break-word rule does not reduce.min-w-0alone stops the pane growing but leaves the token overflowing into the<pre>'s ownoverflow-auto— the below-the-fold scrollbar the fix exists to avoid.Two notes on the numbers:
min-w-[280px]) is the layout-stability half of the report — AC Feature/vector log retention #3.overflow-wrap: anywhere;break-words(overflow-wrap: break-word) is enough here and matches the precedent. The two differ only in min-content contribution, and withmin-w-0present the pane's width is no longer content-derived — confirmed by the 912/912 row.Acceptance criteria
scrollWidth == clientWidth— 1280 / 1280pre912/912)<textarea>) — no pane blow-out. It never blew out (a textarea's width is not content-derived, and Chrome's UA sheet already gives itoverflow-wrap: break-word); measured at root 1280/1280, ta 912/912 to confirm rather than assume.npm run test:unitgreen — 117 files / 2592 tests; no raw-color or loading-gate baseline change (the diff adds no colour classes;scan-raw-colors.mjsexits 0, andloadingGateRatchet.spec.jsis in the passing run)Regression guard
vitest here runs
environment: 'node'with no mount harness — and even a DOM harness computes no layout — so the browser measurement above cannot live in CI.tests/unit/filesPanelPreviewClip.spec.jsis the source-structure guard for it (theagentDetailDeepLink.spec.jsshape). It pins:min-w-0on the preview column;min-w-0necessary, so a future change to a scrolling root forces the reasoning to be re-derived rather than the class silently kept;<pre>;PortalFilePreview.vue, so the two surfaces cannot silently disagree about wrap-vs-scroll.Each assertion was proven load-bearing by reverting its class and watching exactly that test fail.
Fixes #2666
🤖 Generated with Claude Code
https://claude.ai/code/session_01RSjVEjay9ztC1oDXXkh9uN