Repository navigation
Keep wide tables, code and diagrams usable on phones - #471
Conversation
|
Review: Looks good I re-checked 0eead19 on a fresh worktree and server: headless Chromium on iPhone 15 Pro, iPhone SE, 15 Pro landscape, iPad Mini, 1440, 1280, 1024 and 768. All four must-fixes are resolved.
All the earlier nice-to-haves are done too:
The tests are now deterministic. They cover: a cell edit that replaces the table element; the preview node keeping its identity across the wrap/scroll switch; a 1280 fine-pointer case; the Expand row sitting below the drawing; focus returning after both Escape and a tap; and the at-size → Fit → Actual path. Nice to have (not blocking)
Still needs a real device: iOS pinch inside the sheet (page zoom; check Close stays reachable), the table mask while swiping, and safe areas in landscape. |
797d23a to
f354f3a
Compare
When the document is narrower than 40rem: a wide table fades whichever side still hides columns, code and diff previews wrap (with a hanging indent) instead of scrolling a few characters at a time, and a Mermaid or SeeCode diagram below its readability floor offers an Expand button that opens it in a full-screen sheet. Coarse pointers get 44px hit areas on authored tabs and the source toggle. Wide documents are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sheet Code wrap, the table fade and Expand diagram now apply only to a coarse pointer on a small screen with a document under 40rem, so narrow desktop windows with Chat open keep their scroll lanes. Expand sits in a row under the scroll lane, the sheet opens at authored size unless the whole drawing fits legibly, and SeeCode keeps its own controls with no Expand for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ESIGN.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- packages/editor/src/widgets/code-view.tsx: renderer options gain a finite scroll/wrap overflow read from a stylesheet custom property and a constant hanging-indent unsafeCSS string; no caller-supplied values reach styles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test read bounding boxes once, before the wireframe's container query had necessarily applied, and failed in CI with the flow still stacked. Poll the real condition instead of sampling the first layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
326c2c3 to
56397ae
Compare











Why
On a phone the document column is about 320px, and wide authored blocks fight it (mobile critique M-22, M-23, M-24, part of M-25):
What changed
Gate. The code wrap, table fade, Expand diagram button and sheet apply only on a phone with a narrow document. A phone means
(pointer: coarse) and (max-width: 600px), (pointer: coarse) and (max-height: 500px), and narrow means@container (max-width: 40rem). The gate is one@mediablock instyles.cssand onePHONE_QUERY/usePhone()inwidgets/phone.ts. Both switch to:root[data-phone]/usePhone()from../pointeronce slice 2 lands. Narrow desktop windows (1280, 1024, 900, 768 with Chat open) keep their scroll lanes exactly as before (1280 screenshot below). The 44px hit areas apply to any coarse pointer.data-more="start|end|both"). This is the same vocabulary and mask the Mermaid preview and tab strip already use. A small scroll and resize listener sets the attribute, writing it only when the value changes, so it works on iOS Safari 17 without scroll-driven animations. Tables are found again after every editor update, so the fade survives Lexical replacing a table's element. Native panning and the row and column rails are unchanged.--plan-code-overflowswitch.CodeViewreads it in a layout effect before the renderer mounts, so a block is never highlighted twice, and passesoverflow: "wrap"to@pierre/diffs. The renderer's shadow root can't see container queries, which is why it goes through a custom property. Wrapped lines get a 2ch hanging indent. The editable source wraps too, except plain-text fences. There is one owner and no remount: crossing the gate flipsdata-overflowon the same node.diagram-fit.tswith unit tests). Below that floor it keeps its readable size, scroll lane and fade, and gets an Expand diagram button in a row under the scroll lane, so it never covers the drawing. The button opens a full-screen modal sheet:--motion-smooth-out; with reduced motion it fades instead.FitWidthIconandActualSizeIcon.@chopin/diagrams, which is better done as a follow-up. SeeCode keeps its existing scroll lane and zoom controls.ExpandIconin@chopin/icons.Screenshots
iPhone SE, stress fixture. Table, then the same table scrolled (fades on both sides):
Code wraps:
Diagram, with Expand in its own row under the scroll lane:
iPhone 15 Pro: the inline diagram, the sheet at authored size (how it opens), and the sheet after Fit:
iPhone 15 Pro, a realistic document (wrapped code, table scrolled):
Narrow desktop, 1280×800 with Chat open (document 505px). Unchanged; the document region diffs at 0 pixels, as it does at 1440×900:
Testing
e2e/wide-content.e2e.ts, phone cases usinghasTouchat 390×844:data-morefollows scrolling (end, both, start) and keeps updating after a cell edit.scrollwithout a remount.e2e/wide-content.e2e.ts, desktop case at 1280×800 with Chat open: code scrolls, the table has no mask, and there is no Expand button.responsive-content,code,syntax-contrastande2e/design/responsiveare reverted. Those tests use fine pointers, so their assertions still hold.diagram-fit.test.ts: the fit floor, which also covers the sheet's fitted-open path.tab-edges.test.ts:hiddenSides.bun test packages/editor packages/iconspasses.bun run typespasses. dprint, oxlint, tokens, design record and impeccable pass.Design-contract review
Reviewed and renewed in
Renew design-contract review hashes for code-view.tsx:packages/editor/src/widgets/code-view.tsx(dynamic-editor.json): renderer options gainoverflow(one of two literals) and a constantunsafeCSSstring. No new class or style logic.On rebase, main had already added an
ExpandIcontopackages/icons/src/line.tsx, so this PR's separateexpand.tsx(and its exception entry) was dropped in favour of main's icon.Gallery test
e2e/diagram-gallery/gallery.e2e.ts"a wide wireframe keeps its flow across" read bounding boxes once and failed in CI before the wireframe's container-query layout settled. It now polls the real layout condition (same assertions, no loosening).Needs a real device
🤖 Generated with Claude Code