Skip to content

Use a container query for the metric strip, not a viewport one - #188

Merged
vahid-ahmadi merged 1 commit into
mainfrom
fix/vmet-strip-container-query
Aug 26, 2026
Merged

Use a container query for the metric strip, not a viewport one#188
vahid-ahmadi merged 1 commit into
mainfrom
fix/vmet-strip-container-query

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Contributor

My own fix in #187 reintroduced the bug it repaired.

I added @media (min-width: 1500px) to restore the four-up strip on large screens, assuming a wide viewport means a wide column. It doesn't — the column width is set by the scrolly grid. Measured on the live page at a 1728px viewport, that query matched while the column was still 562px, so the strip went back to four-up and clipped again. Same failure mode as the original, from the other side.

innerWidth        1728
mq1500 matches    true      <- fires
column width      562px     <- but the column never grew
strip scrollWidth 659 > 562 <- clipped again

The column width is a container property, so this has to be a container query. Two-up is the floor; four-up returns only when the column itself passes 700px.

Verified against the live DOM

supportsContainer  true
columnWidth        588px
gridTemplateColumns 281px 281px
scrollWidth 562 == clientWidth 562   -> no clipping

Site suite 1564 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lcj9DDqam9KmVCfhEdnJcJ

My own fix in #187 reintroduced the bug it repaired. I added
@media (min-width: 1500px) to restore the four-up strip on large
screens, on the assumption that a wide viewport means a wide column. It
does not: the column width is set by the scrolly grid. Measured on the
live page at a 1728px viewport, that query matched while the column was
still 562px, so the strip went back to four-up and clipped again --
exactly the failure mode, from the other side.

The column width is a container property, so this has to be a container
query. Two-up is now the floor, and four-up returns only when the column
itself passes 700px.

Verified against the live DOM: container queries supported, column
588px, columns resolve to 281px + 281px, scrollWidth 562 == clientWidth,
no clipping.
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
macromod Ready Ready Preview Aug 26, 2026 12:36pm

Request Review

@vahid-ahmadi
vahid-ahmadi merged commit cf54b44 into main Aug 26, 2026
6 checks passed
vahid-ahmadi added a commit that referenced this pull request Aug 26, 2026
* Bump the CSS cache key, and stop flex breaking inline links

Two bugs, both found by measuring the live page rather than the source.

## The CSS fix from #188 was not reaching browsers

style.css is cache-busted by a hand-written `?v=N` in each page's link
tag, and it had sat at v=3 since #180. #187 and #188 both changed
style.css without bumping it, so any browser that had already loaded
`/style.css?v=3` kept serving the old file from cache and never saw the
container-query fix -- confirmed on the live page: the deployed CSS
contained the rule, the browser did not, and the strip stayed clipped
until the stylesheet was reloaded under a different URL.

Bumped to v=4 across 62 pages. Worth noting for future CSS changes: the
version is manual, so it has to move whenever style.css does, or the fix
ships to the CDN and stops there.

## An inline link was breaking mid-word

`.vmet-notes-line` was `display: flex`, which makes EVERY child its own
flex item -- including the inline <a> in the "gated" note. It shrank to
40px and broke "working paper" across three lines, splitting the word.

Replaced with a hanging indent, which reproduces the same key/body look
while leaving inline content in normal flow. Only two pages use this
component and only one line in it carries a link, so the blast radius is
small.

Site suite 1564 passed; contract clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lcj9DDqam9KmVCfhEdnJcJ

* Bump the CSS version in the topic-page generator too

The economy topic pages are emitted by economy/topics.py, which carries
its own copy of the stylesheet link. Bumping the committed HTML without
bumping the template made the two disagree, and the 'Economy topic pages
match committed data' gate caught it. Template updated and all 11 pages
regenerated.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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