On mobile the diff view overflows
Diff view
Cause looks clear from the CSS: the diff <pre> lives in details.diff outside .post .body, so it never gets the overflow-x: auto that markdown code blocks get (.post .body pre). Long diff lines therefore paint past the card edge and make the whole page scroll sideways on phones.
Plan:
- Give
details.diff preits own scroll container (overflow-x: auto, same background/padding as body code blocks) and make sure the card/main can shrink (min-width: 0) so the pre scrolls instead of widening the layout. - Verify with a static mockup of a post card at 390px and ~900px via Playwright (app can't run in the sandbox — no DB).
- Commit + push on
thread/5538ad67.
threadide@cf53788Fixed and pushed on thread/5538ad67 (cf53788). CSS-only change in threadide/app/globals.css.
Root cause. In components/post.tsx the diff is rendered as <details class="diff"><pre>…</pre></details> outside .post .body. Markdown code blocks get .post .body pre { overflow-x: auto }, but the diff pre only had font-size: 12px, so long diff lines (diff --git a/… b/…, hunk headers, any line > ~50 chars) painted straight past the card and widened the whole page. On a 390px viewport the document became 1220px wide → sideways scrolling of the entire thread.
Fix. Give the diff pre its own scroll box, matching body code blocks:
details.diff { min-width: 0; }
details.diff pre { margin: 8px 0 0; padding: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.45;
background: rgba(0,0,0,.05); border-radius: 2px; overflow-x: auto; max-width: 100%; }
details.diff code { font-family: inherit; font-size: inherit; }
Verification (static mockup linking the real globals.css, Playwright/Chromium — the app can't run in the sandbox without Postgres):
| doc scrollWidth | card width | |
|---|---|---|
| before, 390px | 1220px | 358 |
| after, 390px | 390px | 358 |
| after, 900px | 900px | 828 |
Screenshot attached is the 390px "after" — diff scrolls inside its grey box, cards stay full-width. Desktop is unchanged apart from the pre now having the same grey background/padding as other code blocks (previously it was bare text under the summary).
Note for later: anything new added to the post card outside .body (attachments, PR links, etc.) that contains white-space: pre content needs its own overflow-x: auto; .card { overflow-wrap: anywhere } only helps for normal wrapping text. Saved as a memory.
PR can be opened from https://github.com/osebo/threadide/pull/new/thread/5538ad67 when you want it merged.
Diff · 1 files
diff --git a/threadide/app/globals.css b/threadide/app/globals.css
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -176,7 +176,11 @@
details.diff summary { cursor: pointer; color: var(--muted); font-size: 13px; font-family: var(--sans); }
-details.diff pre { font-size: 12px; }
+/* The diff <pre> sits outside .body, so it needs its own scroll box: long diff lines scroll inside the card
+ instead of pushing the whole page sideways on phones. min-width:0 lets the card shrink below the pre's content width. */
+details.diff { min-width: 0; }
+details.diff pre { margin: 8px 0 0; padding: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.45; background: rgba(0,0,0,.05); border-radius: 2px; overflow-x: auto; max-width: 100%; }
+details.diff code { font-family: inherit; font-size: inherit; }
.refs { margin-top: 8px; font-size: 12px; color: var(--muted); }