Skip to content

Commit ecabc71

Browse files
feat: enhance mobile layout by adding min-width control to article elements and improve prose wrapping for better readability
1 parent 66c31cc commit ecabc71

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/pages/post/[slug].astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ const jsonLd = [
102102
jsonLd={jsonLd}
103103
>
104104
<div class="mx-auto grid w-full max-w-7xl gap-10 px-4 py-10 sm:px-6 lg:grid-cols-[minmax(0,1fr)_16rem]">
105-
<article data-pagefind-body>
105+
<!-- min-w-0: on mobile this is an implicit single `auto` grid track, so the article keeps the
106+
default grid-item min-width:auto and won't shrink below its widest descendant (a wide table,
107+
a long inline-code chip) — pushing the whole page sideways on mobile WebKit even though the
108+
table/code scroll containers are individually contained. min-w-0 lets the track shrink so
109+
those scroll containers do their job. (lg: already gets this via minmax(0,1fr).) -->
110+
<article data-pagefind-body class="min-w-0">
106111
<!-- Breadcrumb -->
107112
<nav class="mb-4 text-sm text-muted" aria-label="Breadcrumb">
108113
<a href="/" class="hover:text-accent">Home</a> ›

src/pages/video/[slug].astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ const headings = [...baseHeadings, ...transcriptHeadings.filter((h) => h.depth =
7777
jsonLd={jsonLd}
7878
>
7979
<div class="mx-auto grid w-full max-w-7xl gap-10 px-4 py-10 sm:px-6 lg:grid-cols-[minmax(0,1fr)_16rem]">
80-
<article data-pagefind-body>
80+
<!-- min-w-0: lets the mobile single-column grid track shrink below its widest descendant so
81+
scroll containers (code/tables) stay contained instead of pushing the page sideways on
82+
mobile WebKit. Mirrors post/[slug].astro. (lg: already gets this via minmax(0,1fr).) -->
83+
<article data-pagefind-body class="min-w-0">
8184
<nav class="mb-4 text-sm text-muted" aria-label="Breadcrumb">
8285
<a href="/" class="hover:text-accent">Home</a> ›
8386
{primaryPlaylist && <><a href={`/${primaryPlaylist.slug}`} class="hover:text-accent">{primaryPlaylist.title}</a> › </>}

src/styles/global.css

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,30 @@ summary,
471471
text-align: center;
472472
}
473473

474+
/* ── Prose long-string wrapping (WCAG 1.4.10 Reflow) ──
475+
Defense-in-depth so a long unbroken token in BODY prose (a bare URL, a long path) wraps instead
476+
of running off the right edge / pushing the page sideways on a ~360px phone. `break-word` (NOT
477+
`anywhere`) breaks ONLY a token that would otherwise overflow — it doesn't hyphenate and leaves
478+
normal text untouched, and (unlike `anywhere`) it's ignored for min-content sizing so it can't
479+
surprise the layout. Specificity (0,1,0) beats typography's :where()-wrapped rules without
480+
!important. (Reader notes / FAQs render outside .prose and carry their own overflow-wrap.) */
481+
.prose {
482+
overflow-wrap: break-word;
483+
}
484+
474485
/* ── Inline code (`var` / `CONNECTED_APP_CLIENT_ID`) ──
475486
@tailwindcss/typography styles inline `code` by ADDING literal backtick characters via
476487
`code::before/::after { content: "`" }` and gives it no background — so an inline var read
477488
as `` `var` `` with stray backticks and no visual chip. Render it as a proper bordered chip
478489
using the semantic tokens (flips per theme). Scoped to EXCLUDE `pre code` so Shiki code
479490
BLOCKS are untouched (they own their own frame). The typography rules are :where()-wrapped
480-
(zero specificity), so these single-class rules win without !important. */
491+
(zero specificity), so these single-class rules win without !important.
492+
overflow-wrap:break-word (NOT white-space:nowrap) so a pathologically long chip — e.g. the
493+
`mule.home ++ "/apps/" ++ app.name ++ "/llm-config.json"` formula in a table cell — wraps
494+
instead of forcing horizontal overflow; short chips (`MAC_Config`, `llama3`) still stay on one
495+
line since break-word only acts when a token would otherwise overflow. box-decoration-break:clone
496+
makes each wrapped fragment a clean chip (border/bg/padding per line) instead of an open-ended
497+
slice — same treatment as `.reader-note code`. */
481498
.prose :where(code):not(pre code) {
482499
background-color: var(--code-bg);
483500
border: 1px solid var(--code-border);
@@ -486,7 +503,9 @@ summary,
486503
padding: 0.125em 0.375em;
487504
font-size: 0.875em;
488505
font-weight: 500;
489-
white-space: nowrap;
506+
overflow-wrap: break-word;
507+
-webkit-box-decoration-break: clone;
508+
box-decoration-break: clone;
490509
}
491510
.prose :where(code):not(pre code)::before,
492511
.prose :where(code):not(pre code)::after {

0 commit comments

Comments
 (0)