Repository navigation
fix(Grid): a responsive column shrinks to a container narrower than minWidth - #12383
josephfarina wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
…inWidth
columns={{minWidth}} without max built minmax(<minWidth>px, 1fr), so a
360px floor in a phone column pushed the page sideways. The uncapped track
minimum is now min(100%, <minWidth>px), the same floor the capped form uses.
da4df71 to
2600a90
Compare
|
Owner decision (engineering owner, covering this pull request): a responsive Grid column never grows wider than its container. Its minimum width is clamped to the container ( |
|
/approve-spec 946370b |
|
/approve-spec 94352a8 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| Grid | 4.6 kB (+6 B) · 3.8 kB CSS (0) | — |
| TopNavMegaMenu | 77.4 kB (+6 B) · 12.7 kB CSS (0) | — |
| GridSpan | 3.6 kB (0) · 3.4 kB CSS (0) | — |
Package size:
- @astryxdesign/cli 5.36 MB packed (+8 B); no new dependencies
- @astryxdesign/core 7.65 MB packed (+166 B); no new dependencies
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Thanks — the fix for uncapped Grids in narrow containers works. Two documentation gaps need closing before this can be approved.
packages/cli/assets/docs/tree/responsive.doc.mjsstill says that{minWidth}alone overflows a container narrower thanminWidthand thatmaxis what lets the last column shrink (lines 106 and 126), which contradicts the updated Grid docs and the new FR2.- The changeset leaves out, and the description's "no visual change at widths at or above
minWidth" claim contradicts, that an uncapped Grid in a container sized by its content (for example a flex item with no width in a 600px row, or an inline-block) now shrinks fromminWidthto its content's width (250px to 33px in a probe), so please add one sentence about it to the release note and correct that claim.
The narrow-container behaviour is confirmed in the browser: the new spec passes on this head and its case overflows on the base. Heavy CI did not run on this head because the queue was full, so it needs a re-run before merge.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Changeset, uncapped grids no longer overflow a narrower container: verified (Fill vs fit at 200px: 136px track in a 136px grid; new browser spec passes).
- Changeset, a lone column shrinks as it already did with
max: verified (Grid.tsx:364capped clamp,Grid.tsx:425uncapped clamp). - Changeset, a phone no longer scrolls sideways: verified (375px repro: page width 392px before, 375px after).
- Description, the uncapped template was
minmax(<minWidth>px, 1fr): verified (baseGrid.tsx:422). - Description, the capped form already uses
min(100%, …): verified (Grid.tsx:364). - Description, at or above
minWidththe template resolves as before and nothing visual changes: true for containers with a definite width (1280px frames identical); false for content-sized containers (finding above). - Description, FR2 and the narrow-Grid state are updated: verified (
Grid.spec.mdFR2 row and Representative states). - Description, content-sized behaviour matches what the capped form already does: verified for the capped form (33px before and after); new for the uncapped form (finding above).
- Description, one template string changes in
Grid.tsx: verified (Grid.tsx:425). - Description, the best practice now says one column shrinks with or without
max: verified inGrid.doc.mjs(three locales); the CLI responsive guide is not updated (finding above). - Description, the 360px repro overflows before and fits after: verified with an equivalent fixture.
- Description, the 200px browser test passes and fails on the old template: verified (2 passed on this head; the same story on the base has a 250px track in a 136px grid).
- Description, 1280px still has more than one track, each at least
minWidth: verified. - Description, capped grids are unchanged: verified (capped fixtures pixel-identical).
- Description, a unit test pins
minmax(min(100%, 360px), 1fr): verified (Grid.test.tsx:142-155; 6 of 44 fail on the base). - Description, testing commands (524 unit tests, knowledge check, browser spec): verified, all pass.
- Description, phone and 1280px picture sweep of templates and generated pages: not reproduced.
- Description, no new public API: verified (zero API surface rows).
Files:
.changeset/grid-minwidth-shrinks-narrow.md: finding (missing content-sized note).docs/specs/components/Grid/Grid.spec.md: clear (optional: name the FR2 change under Compatibility).packages/core/src/Grid/Grid.doc.mjs: clear; the CLI responsive guide still needs the same update.packages/core/src/Grid/Grid.test.tsx: clear.packages/core/src/Grid/Grid.tsx: clear.packages/core/src/Grid/__tests__/GridNarrowContainer.a11y.chromium.spec.ts: clear.
… without max; note content-sized containers
|
/approve-spec 23d14be |
There was a problem hiding this comment.
Thanks — both earlier points are fixed: the CLI responsive guide now matches the new rule, and the release note names the content-sized change. One thing still blocks approval:
packages/cli/assets/docs/tree/responsive.doc.mjsships in@astryxdesign/cli, but the only changeset names@astryxdesign/core, so the required lint's "Check Changeset coverage" step fails; add'@astryxdesign/cli': patchto.changeset/grid-minwidth-shrinks-narrow.md, or runpnpm changeset:new --packages @astryxdesign/cli --category docs.
The narrow-container fix and the unchanged wide layout are confirmed in the browser, and the spec change has an engineering owner's approval for this head. Heavy CI was cancelled on this head because the CI queue was full, so it needs a re-run before merge.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset, an uncapped
{minWidth}grid no longer overflows a narrower container: verified (Fill vs fit at 200px: 136px track in a 136px grid; 360px phone fixture: 311px track in a 311px grid). - Changeset, a lone column shrinks as it already did with
max: verified (Grid.tsx:364capped clamp,Grid.tsx:425uncapped clamp). - Changeset, a phone no longer scrolls sideways: verified (375px page width 392px before, 375px after).
- Changeset, in a content-sized container an uncapped grid is now as wide as its content, as a capped grid already was: verified (inline-block and flex-item probes 250px to 24.5px; capped 24.5px on both sides).
- Description, a 360px floor overflows a phone column: verified with an equivalent fixture (360px track in a 311px grid).
- Description, the uncapped template was
minmax(<minWidth>px, 1fr): verified (baseGrid.tsx:422). - Description, the capped form already uses
min(100%, …): verified (Grid.tsx:364). - Description, a container with a definite width at or above
minWidthresolves the same tracks: verified (1280px frames pixel-identical). - Description, FR2 and the narrow-Grid state are updated and record the content-sized case: verified (
Grid.spec.md:98,:118). - Description, one template string changes in
Grid.tsx: verified (Grid.tsx:425). - Description, the Grid best practice and the responsive guide now say one column shrinks with or without
max: verified (Grid.doc.mjs:34,:143,:161;responsive.doc.mjs:106,:126). - Description, no new API or default: verified (0 public-surface rows).
- Description, the release note and the Grid record name the content-sized change: verified (changeset line 5, FR2).
- Description, the 200px browser test fails on the old template and passes on the new one: verified by probe (250px track in a 136px grid before, 136px after); the spec is unchanged since it passed on the previous head.
- Description, 1280px still has more than one track, each at least
minWidth: verified (fill 4 × 292px; fit 600px, 600px). - Description, capped grids are unchanged: verified (capped fixture pixel-identical).
- Description, a unit test pins
minmax(min(100%, 360px), 1fr): verified (Grid.test.tsx:78-91). - Description, testing commands: unit suites 524 passed and the knowledge check aligned, verified; CLI doc tests 352 passed over the doc-compiler and docs-graph suites (the reported 444 covers a wider set); the Playwright run was not repeated here.
- Description, phone and 1280px picture sweep of templates and generated pages: not reproduced.
- Description, no internal context in public text: verified.
Files:
.changeset/grid-minwidth-shrinks-narrow.md: finding (does not name@astryxdesign/cli).docs/specs/components/Grid/Grid.spec.md: clear (optional: name the FR2 change under Compatibility and migration).packages/cli/assets/docs/tree/responsive.doc.mjs: clear text; needs the CLI changeset above.packages/core/src/Grid/Grid.doc.mjs: clear.packages/core/src/Grid/Grid.test.tsx: clear.packages/core/src/Grid/Grid.tsx: clear.packages/core/src/Grid/__tests__/GridNarrowContainer.a11y.chromium.spec.ts: clear.
|
/approve-spec 23fa8d9 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet (its run was cancelled because CI was full, and the CLI smoke test timed out while checking out the repository), so it needs a re-run before merge. The last open point is fixed: the release note now names @astryxdesign/cli for the updated responsive guide, and the changeset coverage check passes.
The narrow-container fix and the unchanged wide layout are confirmed in a real browser, and the Grid spec change has an engineering owner's approval for this head. Two optional follow-ups: the Grid record's compatibility lines (Grid.spec.md:46, :47, :60) still say it changes no runtime behaviour, and a browser case for FR2's content-sized clause would guard it.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset, an uncapped
{minWidth}grid no longer overflows a narrower container: verified (Fill vs fit at 200px: 136px track in a 136px grid; phone fixture: 311px track in a 311px grid; the new browser spec passes). - Changeset, a lone column shrinks as it already did with
max: verified (Grid.tsx:364capped clamp,Grid.tsx:425uncapped clamp). - Changeset, a phone no longer scrolls sideways: verified (375px page width 392px before, 375px after).
- Changeset, in a content-sized container an uncapped grid is now as wide as its content, as a capped grid already was: verified (inline-block and flex-item probes 250px to 18.4px; capped 18.4px on both sides).
- Changeset, the note covers both the core and CLI packages: verified (changeset coverage passes; the CLI change is the responsive guide).
- Description, a 360px floor overflows a narrower phone column: verified with an equivalent fixture (360px track in a 311px grid).
- Description, the uncapped template was
minmax(<minWidth>px, 1fr)and the capped form already usesmin(100%, …): verified (baseGrid.tsx:422, headGrid.tsx:364). - Description, a container with a definite width at or above
minWidthresolves the same tracks: verified (1280px frames pixel-identical). - Description, FR2 and the narrow-Grid state are updated and record the content-sized case: verified (
Grid.spec.md:98,:118). - Description, one template string changes in
Grid.tsx: verified (Grid.tsx:425). - Description, the Grid best practice and the responsive guide now say one column shrinks with or without
max: verified (Grid.doc.mjs:34,:143,:161;responsive.doc.mjs:106,:126). - Description, no new API or default: verified (0 public-surface rows in every published package).
- Description, the release note and the Grid record name the content-sized change: verified (changeset line 6, FR2).
- Description, the narrow browser test fails on the old template: verified by probe (250px track in a 136px grid on the base); the spec passes 2 of 2 on this head.
- Description, 1280px still has more than one track, each at least
minWidth: verified (fill 4 × 292px; fit 600px, 600px). - Description, capped grids are unchanged: verified (capped fixture pixel-identical).
- Description, a unit test pins
minmax(min(100%, 360px), 1fr): verified (Grid.test.tsx:78-91). - Description, testing commands: unit suites 524 passed, knowledge check aligned and browser spec 2 passed, verified; the CLI doc-test count was not reproduced exactly.
- Description, phone and 1280px picture sweep of templates and generated pages: not reproduced.
- Description, no internal context in public text: verified.
Files:
.changeset/grid-minwidth-shrinks-narrow.md: clear.docs/specs/components/Grid/Grid.spec.md: clear (optional: compatibility lines 46, 47 and 60).packages/cli/assets/docs/tree/responsive.doc.mjs: clear.packages/core/src/Grid/Grid.doc.mjs: clear.packages/core/src/Grid/Grid.test.tsx: clear.packages/core/src/Grid/Grid.tsx: clear.packages/core/src/Grid/__tests__/GridNarrowContainer.a11y.chromium.spec.ts: clear.
- #12680 perf(cli): a template's component line resolves its names in one pass, not one full lookup per name Author: Joey <[email protected]> - #12180 fix(core): Calendar weekday names widen their column instead of overlapping Author: Joey <[email protected]> - #12159 feat(cli): make an icon set inside your own app Author: Joey Farina <[email protected]> - #12383 fix(Grid): a responsive column shrinks to a container narrower than minWidth Author: Joey Farina <[email protected]> - #12374 [fix] Icon: a glyph given as name renders and warns, instead of crashing Author: Joey Farina <[email protected]> - #12453 fix(charts): line, area and band default to straight segments Author: josephfarina <[email protected]> - #12296 fix(core): a neutral Badge in a primary or destructive Button meets 4.5:1 on its fill Author: Joey Farina <[email protected]> - #12395 fix(CodeBlock): without a code string, CodeBlock names the prop and the fix in development Author: Joey Farina <[email protected]> - #12260 fix(cli): `astryx component Flex` names Stack first Author: Joey Farina <[email protected]> - #12391 fix(core): a two-lane Toolbar wraps instead of squeezing its start lane Author: Joey Farina <[email protected]> - #12427 fix(core): checkbox and radio marks keep their share of the box a theme sizes Author: josephfarina <[email protected]> - #12725 [experimental] cli: with no icon set, experimental icon names the discover search where it lists packs Author: Joey Farina <[email protected]>
|
Landed in #12738. |
Record change:
component:GridFR2 — a lone track shrinks to a container narrower thanminWidthwith or withoutmax(it shrank only withmax); in a content-sized container a track takes its content's width.Validation: real-layout browser test (fails on the old template, passes on the fix) and an automated phone-width check sweep (375/390, light and dark, planted controls all correct): more pages pass, none worse; 1280 results unchanged.
User impact
A page that uses
Gridwithcolumns={{minWidth: 360}}(nomax) on a phone shows cards cut off at the right edge, and the content area scrolls sideways. On a 375px phone with 16px page padding the container is 343px, but each track is at least 360px, so the grid is wider than the screen. The cards' right side, including chart labels and controls, is hidden until the reader scrolls sideways.Problem and solution fit
max, Grid buildsrepeat(auto-fill, minmax(<minWidth>px, 1fr)). A track can never be narrower thanminWidth, even when the container is narrower.{minWidth}withoutmaxis a common way to ask for "columns that reflow", and the capped form already shrinks a lone track to the container (min(100%, …)). The two forms disagree only belowminWidth, where the uncapped form breaks the page.The fix wraps the uncapped track minimum in the same
min(100%, …)the capped form uses. At or aboveminWidththe template resolves exactly as before.Expected behavior and authority
component:GridFR2 and the responsive states: object-form columns reduce their count to fit. This PR updates FR2 and the narrow-Grid state so a lone track shrinks to a narrow container with or withoutmax. It also records what the capped form already does in a container that takes its width from its content: a track takes its content's width.Smallest restoration
One template string in
Grid.tsx(uncapped branch). Docs: the Grid best practice and the responsive layout guide said{minWidth}alone overflows a phone; they now say one column shrinks to the container, with or withoutmax. No new API or default. A Grid in a container with a definite width at or aboveminWidthresolves the same tracks as before.One visible change beyond narrow containers: in a container that takes its width from its content (an inline-block, or a flex item with no width), an uncapped Grid is now as wide as its content instead of
minWidth, as a capped Grid already was. The release note and the Grid record say so.Evidence
<Grid columns={{minWidth: 360, repeat: 'fit'}}>with two cards at 375px or 390px. The track is 360px in a 343px or 358px container, and the content area scrolls sideways.minWidth:GridNarrowContainer.a11y.chromium.spec.tsopens the Fill vs fit comparison story ({minWidth: 250}, fill and fit, nomax) at a 200px viewport. Each grid has one track no wider than the grid, nothing scrolls inside the grid, every item stays inside it, and the page does not scroll sideways. With the old template the same test fails (track 250px in a 136px grid).minWidth,min(100%, Npx)isNpx, so the template resolves as before. The same story test checks that a 1280px viewport still gets more than one track, each at leastminWidth. The template sweep at 1280 (light and dark) gives the same check results on every page before and after.max) are unchanged.minWidthbefore). The capped form already behaved this way.Grid.test.tsxpins the uncapped templateminmax(min(100%, 360px), 1fr); the browser test above pins the layout.Scope
Components: Grid
Testing
CI=1 vitest run --project ui packages/core/src/Grid packages/core/src/theme/themingTargets.test.ts packages/core/src/serverSafeComponents.test.ts(524 passed)node scripts/check-knowledge.mjs(aligned)CI=1 vitest run --project nodeover the CLI doc-tree, docs-graph and doc-compiler tests (444 passed)playwright test --project chromium packages/core/src/Grid/__tests__/GridNarrowContaineragainst a built Storybook (2 passed; the narrow test fails on the old template)