[Bug][Mobile]: Markdown table columns are a fixed 160dp width, so long cells wrap into narrow tall columns
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/mobile
Steps to reproduce
-
Open a thread in the mobile app (Android).
-
Have the agent reply with a Markdown table that has a short first column and a long second column, e.g.
| PR | Fixes | | --- | --- | | #22 | Nothing needed. | | #23 | A long paragraph of several sentences describing multiple fixes … |
Expected behavior
Columns are sized to their content (like the web/desktop table), and a table narrower than the screen uses the available width. Wide tables still scroll horizontally.
Actual behavior
Every column has the same fixed width, regardless of content. The short PR column gets as much space as the long Fixes column, which wraps into a very tall, narrow cell while ~40% of the screen to the right of the table stays empty. (At first glance it looks like the first row decides the width, but every column is just a constant width.)
Cause
NativeTable in apps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsx gives every cell a hard-coded width:
<View style={{ width: 160, borderLeftWidth: ..., paddingHorizontal: 10, paddingVertical: 8 }}>
Each row is an independent flexDirection: "row" of fixed 160dp cells inside a horizontal ScrollView. Nothing measures content, shares widths per column across rows, or stretches the table to the container width. In the screenshot both columns are exactly the same width (~160dp each).
This has been the behavior since the native markdown renderer was introduced (#3101).
Platforms:
- Android: observed (screenshot below).
- iOS: expected to be affected too.
SelectableMarkdownTextroutes both platforms through the sameNativeMarkdownBlock/NativeTablepath. Not verified on a device. - Web/desktop: not affected. They render a real HTML
<table>withwidth: 100%; min-width: max-content(apps/web/src/index.css), so the browser does content-based column sizing.
Related but different: #3551 (web UI in an Android browser, closed), #10952 / #13443 (web table width).
Impact
Minor bug or occasional failure
Version or commit
Mobile app v2.0 (latest store release, 2.0.0). Code is unchanged on main @ 40596072eb.
Environment
Android, T3 Code mobile v2.0
Screenshots
[!NOTE] Grok responding on behalf of Julius.
Triage
Thanks for tracking this down to the exact line, @simonsteiner. I confirmed it on current main, and it isn't a duplicate of #3551 (web UI in an Android browser), #10952, or #13443 (web/desktop table width).
What I found
NativeTableinapps/mobile/modules/t3-markdown-text/src/NativeMarkdownBlock.tsxsetswidth: 160on every cell, and each row is its ownflexDirection: "row"inside a horizontalScrollView. Nothing measures the text, shares a width per column, or stretches a short table to the message width, which matches your screenshot.- This layout dates back to the native renderer in #3101. iOS uses the same
NativeTablethroughSelectableMarkdownText(only Android setsnestedScrollEnabled), so it very likely shows the same fixed columns there too, though I haven't checked on a device. - Web and desktop use a different renderer:
.chat-markdown tableiswidth: 100%withmin-width: max-content, so a narrow table fills the column and a wide one scrolls. Cells also have a24remcap there (truncated when collapsed, wrapped when expanded), so web isn't fully content-sized either. - Just removing the constant probably isn't enough. Percentage widths inside the shrink-to-fit bubbles already make Yoga measure text on an unbounded pass (see
SelectableMarkdownText), so an explicit width per column looks necessary.
Likely fix area
NativeTable: one option is computing a single width per column, shared by every row, so short columns stay short, a table narrower than the message fills the available width, wider tables still scroll, and long cells wrap within a bounded column. The cap would need picking, possibly along the lines of web's24rem.
A maintainer will decide on the fix direction.
Thanks for the triage. I replaced the original screenshot (it showed another project) with four dedicated repros on Android, mobile v2.0. Each thread has the same table twice: in the sent message bubble and in the assistant reply.
- Short + long column (
PR/Fixes):PRgets the full 160dp for#22, while the longFixescell wraps into a ~15-line narrow column. The table ends at ~60% of the screen width. - Long first column (
Description/Status): the reverse. The descriptions wrap over 4–6 lines whileStatus(Open,Fixed) sits in an equally wide, mostly empty column. - Five columns (
Provider/Model/Context/Notes/Status): short values like1Mand?each take 160dp, so only 3 columns fit on screen andNotesis pushed off the edge. The longNotescell still wraps inside its 160dp, which makes every row taller. - Inline code, links, long header: the
#column (single digits) takes 160dp while the long header wraps over 3 lines. In the sent message bubble, theNativeMarkdownBlock.tsxfile chip in the third column is cut off at the bubble edge.
So the fixed width hurts in both directions: short columns waste space, and long cells and headers wrap even when there's room. It also affects tables in the message bubble, not only assistant replies. A per-column width shared by every row, as suggested above, would cover all four cases.
[!NOTE] Grok responding on behalf of Julius.
Resolved by #16979. The mobile Markdown renderer, including the NativeTable in NativeMarkdownBlock.tsx with the fixed 160dp cells, was replaced by Enriched Markdown, which lays out tables itself. If columns still look wrong on a build that includes #16979, comment with a screenshot and we'll reopen.