Skip to content

Fix horizontal overflow on the behavioral responses page at 375px - #55

Merged
MaxGhenis merged 1 commit into
masterfrom
fix-behavioral-mobile-overflow
Oct 14, 2026
Merged

MaxGhenis merged 1 commit into
masterfrom
fix-behavioral-mobile-overflow

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

At a 375px viewport, /us/model/behavioral had document.documentElement.scrollWidth 450, so the page scrolled sideways on phones.

Cause and fix (src/components/theory/BehavioralResponses.tsx)

  1. The elasticity table set the page width. The table had min-w-[400px] inside an overflow-x-auto wrapper, and a scroll container's min-content width still comes from its contents. On mobile, AppShell's <main> has mx-auto inside a column flexbox and no width, so it sizes to fit its content. It widened to 400 + 2px border + 48px padding = 450px. Even with the overflow contained, a 400px table would hide its "Upper" column at 375 and cut off "Central" at 320. The table's own min-content width is about 250px.
  2. The concepts cards and budget-constraint chart were always two columns. This never widened the page, but once the page fits 375px a two-column grid would squeeze the chart to 98px (70px at 320). Fix: tw:grid-cols-1 tw:md:grid-cols-2, so they stack below 768px.

Verification

I measured in the built-in browser using same-origin iframes of fixed width, with scrollbar-width: none to match a phone's overlay scrollbars, after a 2.5s settle. For desktop I hashed the geometry (tag plus rounded x/y/width/height) of every element in <main>. Each comparison runs master and this PR on the same kind of server (dev against dev, production against production).

Viewport master scrollWidth this PR Table wrapper visible / content width (PR) Desktop geometry vs master
320 450 320 270 / 270 (intended change)
375 450 375 325 / 325 (intended change)
768 768 768 718 / 718 identical
1024 1024 1024 718 / 718 identical
1440 1440 1440 1134 / 1134 identical

Review

Two separate Opus 5.5 reviews looked at this.

First review, four rounds. Round 1 requested changes:

  • the 400px min-width still hid the "Upper" column;
  • my first diagnosis wrongly said the two-column grid also widened the page.

Both were reproduced and fixed, and rounds 2–4 approved. The later rounds tightened the regression test and collapsed the branch into one commit with an accurate message.

Second review (read-only, no shell). It approved. It also corrected my chart-width wording: on master the chart was 135px on a page that was 450px wide, and 98px is what a two-column grid would give once the page fits. That wording is fixed here and in the commit.

Not in this PR (queued separately)

  • Every ?compare=all view overflows at 375px (behavioral 1058, overview 1200, coverage 1200, calibration 893, pipeline 588, validation 706). /data/pipeline and /data/calibration overflow by default. The root cause is the mobile <main> in AppShell, which lacks the w-full the desktop <main> has.
  • The budget chart's y-axis repeats labels ($0k, $0k, $1k, $1k, $2k). This predates the PR.

axiom: n/a: layout-only UI change

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
policyengine-model Ready Ready Preview Oct 14, 2026 2:43pm UTC

Request Review

At a 375px viewport /us/model/behavioral had scrollWidth 450.

The elasticity table's 400px min-width was the cause. Its overflow-x:auto
wrapper still passed that width up as its min-content size. The mobile
<main> has mx-auto in a column flexbox and no width, so it sized to fit and
widened the page. The table's own min-content width is about 250px, so the
min-width is dropped and all four columns now fit at 320px and wider.
contain: inline-size on the wrapper guards against anything wider widening
<main> again.

The concepts cards and budget-constraint chart now stack below md
(tw:grid-cols-1 tw:md:grid-cols-2). Once the page fits 375px, a two-column
grid would squeeze the chart to 98px.

scrollWidth now equals the viewport at 320, 375 and 390px. The geometry of
every element in <main> is unchanged at 768, 1024 and 1440px, checked on
both dev servers and production builds. A class-level regression test
guards both changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the fix-behavioral-mobile-overflow branch from 310a42e to 9a002a6 Compare October 14, 2026 14:43
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 14, 2026 14:45
@MaxGhenis
MaxGhenis merged commit 5f208f8 into master Oct 14, 2026
2 checks passed
@MaxGhenis
MaxGhenis deleted the fix-behavioral-mobile-overflow branch October 14, 2026 14:45

This branch was successfully deployed

1 active deployment
Preview — 9a002a68 Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant