Repository navigation
fix(mobile): wrap code blocks and keep long ones expandable - #713
Merged
Merged
Conversation
A fenced block was a horizontal scroll region, and past 10k characters or 16 lines it became a fixed 360dp inner FlatList. On a phone that meant prose in a fence could not be read at phone width, and the tail of a long block sat behind a nested vertical viewport that loses the pan gesture to the message list. Render code at the block width instead (no horizontal ScrollView), and collapse a long block to a wrapped 16-line preview with a tail ellipsis plus an explicit expand/collapse control that paints every bounded chunk inline — the tail is one tap away rather than unreachable. Copy still yields the unmodified source.
huichen
enabled auto-merge (squash)
September 17, 2026 14:39
huichen
added a commit
that referenced
this pull request
Sep 26, 2026
A table with more than 20 rows kept the rest behind a fixed 360dp inner list.
That viewport did not scroll on the phone: the vertical drag belongs to the
list the table sits in, which takes the move before the nested list sees it, so
the promise printed under the table ("scroll inside the table to see the rest")
was false and rows 21+ could not be reached at all — the same nested-viewport
failure the long code block was fixed for in #713.
Paint the first 20 rows and put the rest behind an explicit control, which
paints every remaining row inline and lets the surrounding list scroll them.
The horizontal scroller stays: a wide table still pans sideways.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A fenced code block in a mobile chat message was rendered as a horizontal scroll region; past 10 000 characters or 16 lines it also became a fixed 360 dp inner
FlatList. Two consequences, both visible in the report:Change
mobile/src/components/MarkdownText.tsx(CodeSource):ScrollViewis gone, soTextwraps naturally (thecolumns/fontScalewidth computation andcodeContentstyle go with it).largethreshold as before) collapses to a wrapped 16-visual-line preview with a tail ellipsis, plus an explicit 展开代码 / 收起代码 control. Expanding paints every bounded source chunk inline, so the whole block is reachable by scrolling the message — no nested vertical viewport, no lost gesture.largeimplies more than 16 visual lines, the control is never a no-op.mobile/docs/remaining-performance-2026-09-16.mdand the paireddocs/internals/mobile/markdown-rendering-audit{,.zh-CN}.mdacceptance item were updated — "horizontally readable to the end" is no longer the expected behaviour.Verification
mobile:npx jest src/components src/i18n --runInBand(266 tests, incl. rewrapped code tests),tsc --noEmit,eslint --max-warnings 0; related suites (TimelineCard,MarkdownImage,fileActionSurfaces,markdownParsing,codePreviewRows,codeHighlight) all pass.-webkit-line-clamp: 16/line-height: 20px→ 344 px tall withscrollHeight492 (truncated, ellipsis); after expanding,clientHeight === scrollHeight(504) with the previously hidden tail lines painted; the control toggles both ways and is a 350×44 target.Not verified: a real-device touch pass on Android/iOS (the checklist item above covers it).