Skip to content

fix: size the module grid by its container, not the window - #81

Merged
intech merged 1 commit into
mainfrom
fix/module-grid-container-width
Aug 6, 2026
Merged

fix: size the module grid by its container, not the window#81
intech merged 1 commit into
mainfrom
fix/module-grid-container-width

Conversation

@intech

@intech intech commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The package cards on /en/packages/ and /en/reference/ render squeezed, while the same component on the home page looks right.

container columns card width longest name
home page, 1440px window 1180px 3 385px 1 line
/en/packages/, 1440px window 688px 3 221px 2 lines
/en/packages/, 1280px window 624px 3 200px 3 lines, broken mid-word

Cause

The grid asked a viewport media query how many columns to draw, but the component appears in two very different boxes: the home page gives it the full 1180px section, while the documentation pages put it inside the 688px content column. A viewport query cannot tell those apart, so a wide window handed the narrow column a three-column grid. The breakpoints that would have dropped it to two columns only fire when the window shrinks — which also shrinks the documentation column, so they never help.

Fix

The grid now answers to its own container, via container-type: inline-size on .module-groups and @container breakpoints. The two thresholds are the container widths the old viewport breakpoints worked out to, so the home page keeps exactly the layout it has today.

The old viewport rules for .module-grid are removed; the other selectors in those media queries are untouched.

Result

before after
/en/packages/, /en/reference/ at 1600 / 1440px 3 × 221px 2 × 338px
/en/packages/, /en/reference/ at 1280 / 1024px 3 × 200px, names on 3 lines 2 × 306px, names on 2 lines
home page, all widths unchanged
every page below 900px unchanged

Validation

pnpm docs:build and pnpm docs:validate:built pass, as does pnpm docs:validate on sources. The @container rules and container-type survive the production CSS pipeline, and the built output measures identically to dev.

Column count and card width were measured on all three pages that use the grid, at nine viewport widths from 1600 down to 375, before and after. The home page is identical to its current behaviour at every one of them; only the two documentation pages change.

Separately, every page was scanned at four viewport widths for any other multi-column layout inside the documentation column whose column count came from a viewport query. .module-grid was the only one. The remaining narrow columns all belong to home-page sections in a 1180px box, where they are intended.

Without @container support a browser falls back to a single column rather than a broken layout. The feature has been available in all major browsers since 2022–2023.

🤖 Generated with Claude Code

@intech intech self-assigned this Aug 6, 2026
@github-actions github-actions Bot added the type:bug Bug report: something is not working as documented label Aug 6, 2026
@intech intech added priority:medium Default priority type:docs Documentation: guides, README, JSDoc labels Aug 6, 2026
The package cards on /en/packages/ and /en/reference/ were squeezed to 221px
(200px at a 1280px window, where the longest package names broke across three
lines mid-word), while the same component on the home page looked right at
385px.

The grid asked a viewport media query how many columns to draw, but the two
usages sit in very different boxes: the home page gives it the full 1180px
section, the documentation pages put it inside the 688px content column. A wide
window therefore handed the narrow column a three-column grid.

The grid now answers to its own container. The thresholds are the container
widths the old viewport breakpoints worked out to, so the home page keeps the
layout it had -- verified identical at nine viewport widths from 1600 down to
375 -- while the documentation pages drop to two columns and 338px cards.

A scan of every page at four viewport widths found no other multi-column layout
inside the documentation column whose column count came from a viewport query;
the remaining narrow columns are all home-page sections in a 1180px box, where
they are intended.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@intech
intech force-pushed the fix/module-grid-container-width branch from 505aecd to f9c312a Compare August 6, 2026 16:43
@intech
intech merged commit b50bb06 into main Aug 6, 2026
1 of 6 checks passed
@intech
intech deleted the fix/module-grid-container-width branch August 6, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Default priority type:bug Bug report: something is not working as documented type:docs Documentation: guides, README, JSDoc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant