Repository navigation
fix(mobile): scroll wide tables sideways in the rich Markdown editor - #36966
Conversation
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ca6f210c-e00d-46c4-af0f-5e05c592f225
Files selected for processing: 1-
mobile/src/components/rich-markdown/document-style.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
-
8c1f1b0 to
9306e85
Compare
ELI5
On a phone, a Markdown table with many columns in the rich editor got crushed into the screen width, so words broke one letter per line. Now a wide table scrolls sideways on its own, like a code block does, and small tables look the same as before.
What Changed
mobile/src/components/rich-markdown/document-style.ts):#editor'soverflow-wrap: anywhere. That shrinks each cell's minimum width to one glyph, so auto table layout squeezes every column to fit.tablebecomesdisplay: block; overflow-x: auto, so it scrolls itself.overflow-wrap: break-wordandword-break: keep-all, so a column is never narrower than its longest word, CJK runs included.max-width: 16em, so a URL can't make one huge column (chat caps its columns at about 220px).width: 1%. A block-displayed table otherwise shrinks narrow tables to their content width; the 1% keeps them stretched to full width.Why
<div>rejected. This is the usual approach (Tiptap'stableWrapper), but the editor is a raw contenteditable with its own serializer.html-block-markdown.tsflattens adiv's content inline, so a wrapper needs serializer changes, plus handling for text typed inside it and Enter cloning it. The CSS change keeps the markup and Markdown round trip untouched.width: 1%cells, grid spreads width evenly instead, giving a 99px ID column.min-widthon cells rejected. It makes short 3- and 4-column tables scroll for no reason. Columns now size to whole words, the same rule desktop's editor uses.Linked Issue
Fixes #36412
Visual Proof
iOS 27 simulator Safari, iPhone width, real iOS WebKit, with the editor's real stylesheet and table markup. On iOS the editor runs in the page, so the DOM and CSS are the same. Left: main. Middle: this PR. Right: this PR after a touch swipe on the table. Only the table moves; the heading and the narrow table stay put.
Testing
Measured main and this branch with the real stylesheet in Playwright Chromium (Android WebView engine) and WebKit (iOS engine) at 390x844:
#editor: never overflows horizontally.Real touch swipe on the table in iOS 27 simulator Safari (screenshots above).
Editing through the real document mount (
mountRichMarkdownWebDocument) in both engines:page-stylesheet.test.tspasses;check:code-quality:changed, react-doctor and oxfmt are clean.I manually tested these changes locally
Automated tests added/updated, or explained why not below
No automated test: jsdom can't lay out tables, and asserting the CSS text would only restate the stylesheet.
AI Disclosure
Review
Two independent reviews (Codex and Claude) ran:
word-break: keep-all. A 7-column Chinese table went from 51px columns to a 689px scroller.code<br />Keyresult.Agent skill upstream boundary
Notes
Waiting for blessing. What to try (worktree
/Users/kelvinamoaba/orca/workspaces/orca/mobile-wide-tables-36412):Open a Markdown file with a 6–7 column table in the phone's rich editor. The table scrolls sideways, columns keep whole words, and the page itself doesn't move sideways.
Check a 2–3 column table. It still fills the width with no scrolling.
Tap below a table that ends the document and type. The caret goes to the end of the table's last row, like a trailing code block or quote. On main the text jumped above the table.
Mobile only: one stylesheet, used by the native WebView document and, scoped under
.orca-rich-markdown-document-host, by the page host.No effect on: wire format, host compatibility, SSH or desktop.
Related outside PR fix(mobile): allow horizontal scrolling for wide rich markdown tables #36413 makes a similar CSS change; this is our rebuild on latest main.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)