Commit 7328f50
docs: fix mobile horizontal scroll via contain:layout
The real culprit was Chrome mobile's layout-viewport auto-expansion.
Even when wide content (the comparison table, long code lines) sat
inside an overflow-x:auto wrapper, mobile browsers still measured the
descendant's intrinsic width when sizing the layout viewport — which
expanded from device-width to ~2× device-width and dragged the fixed
nav header along with it. Applying `contain: layout` to every
overflow-x:auto wrapper inside <main> isolates the wrapper's intrinsic
width from the layout-viewport calculation while keeping the inner
horizontal scroll intact.
Verified via Playwright at 375×800 with isMobile:true:
- before: window.innerWidth = 776, html.scrollWidth = 776
- after: window.innerWidth = 375, html.scrollWidth = 375
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bf0100b commit 7328f50
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
55 | 83 | | |
56 | 84 | | |
57 | 85 | | |
| |||
0 commit comments