Skip to content

fix(Layout): a Layout with no contentWidth caps no header or footer - #10715

Merged
cixzhang merged 1 commit into
mainfrom
fix/layout-content-width-default
Nov 8, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/layout-content-width-default

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

User impact

Anyone who puts a Layout without contentWidth in a frame wider than the browser window (a scrolling canvas, a wide embed, a horizontally scrolling board) sees its LayoutHeader and LayoutFooter content stop at the window's width, while the content region below spans the whole frame. Header actions and footer controls end up stranded mid-frame.

After this change the header and footer span the frame, like the rest of the Layout. Layouts that set contentWidth, and frames narrower than the window, render as before.

Problem and solution fit

  • Why it occurs: Layout resets --layout-content-width to 100cqi for its descendants. LayoutHeader and LayoutFooter read it as max-width: var(--layout-content-width, none), but only the middle row is a query container. So in the header and footer, 100cqi resolves against an outer query container, or the viewport when there is none.
  • The fix: the reset is now initial, a guaranteed-invalid value, so every var(--layout-content-width, none) falls back to none, which is the default component:Layout states. --layout-alignment-width stays 100cqi: LayoutContent reads it only for padding math inside the middle row's container, where 100cqi is that row's own width.
  • Nested Layouts: they still drop a parent's contentWidth (component:Layout FR6), now through initial instead of 100cqi. The styles that read --layout-content-width for alignment apply only when contentWidth is set.

Expected behavior and authority

component:Layout: the Content width row's default is "none", and FR6 says a nested Layout without contentWidth does not inherit its parent's.

Smallest restoration

  • Layout.tsx: --layout-content-width: 'initial' in the inner reset, with the comment updated.
  • contentWidth.test.tsx: the nested-reset expectation reads initial.
  • A Storybook story, Core/Layout › No Content Width — Frame Wider Than the Viewport (a 2400px frame), and a Chromium spec over it.
  • component:Layout's FR6 verification row and verified_by name the new spec.
  • A patch [fix] Changeset for @astryxdesign/core.

Evidence

  • Reproduction before the change: LayoutContentWidthDefault.a11y.chromium.spec.ts against a Storybook built from main plus the story, at a 1280px viewport. The header's and footer's inner wrappers measure 1280px inside a 2400px frame: both cases fail.
  • Result after the change: the same spec passes; both inner wrappers measure 2400px.
  • Representative unchanged paths: the Layout, AppShell and derived-variable unit suites (375 tests) pass, including every contentWidth case (no panels, one panel, both, nested, percentage widths).

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • LayoutContentWidthDefault.a11y.chromium.spec.ts: 0 of 2 pass on main, 2 of 2 here.
  • vitest for Layout, AppShell and theme/derivedVarRegistry.test.ts: 13 files, 375 tests pass.
  • pnpm check:knowledge, check:changesets and strict ESLint on the changed files: clean.

Layout reset --layout-content-width to 100cqi for descendants. LayoutHeader and LayoutFooter read it as max-width, but only the middle row is a query container, so in the header and footer 100cqi resolved to an outer container or the viewport. In a frame wider than the viewport they stopped at the viewport's width. The reset is now 'initial', so their var(--layout-content-width, none) falls back to none, as component:Layout's default says. --layout-alignment-width stays 100cqi: LayoutContent reads it only inside the middle row's container.

Red first: LayoutContentWidthDefault.a11y.chromium.spec.ts fails on main (inner wrapper 1280 of a 2400 frame) and passes here.
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 8, 2026 10:08pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 8, 2026
@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 10:21 PM UTC

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 8, 2026
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 827bf23

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 827bf23

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
AlertDialog 105.4 kB (+1 B) · 14.6 kB CSS (+3 B) — — · — · —
CommandPalette 73.1 kB (−1 B) · 12.7 kB CSS (+4 B) — — · — · —
Layout 7.0 kB (0) · 2.3 kB CSS (+3 B) — ✓ · ✓ · ✓
10 more components
Component Size LoC Visual · A11y · RTL
PowerSearch 285.0 kB (0) · 24.1 kB CSS (+3 B) — — · — · —
Tokenizer 91.4 kB (0) · 18.8 kB CSS (+2 B) — — · — · —
lab/Comments 348.3 kB (+1 B) · 2.5 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 277.7 kB (+1 B) · 454 B CSS (0) — — · — · —
LayoutContent 17.7 kB (0) · 1.7 kB CSS (0) — ✓ · ✓ · ✓
LayoutFooter 6.1 kB (0) · 1.6 kB CSS (0) — ✓ · ✓ · —
LayoutHeader 6.2 kB (0) · 1.6 kB CSS (0) — ✓ · ✓ · —
LayoutPanel 21.3 kB (0) · 4.9 kB CSS (0) — ✓ · ✓ · ✓
lab/CommentThread 341.6 kB (0) · 2.4 kB CSS (0) — — · — · —
AppShell 90.9 kB (0) · 13.5 kB CSS (−12 B) — — · — · —

Package size: @astryxdesign/core 7.17 MB packed (+26 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 34 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because drafts run no CI; marking the pull request ready for review starts it.

Resetting --layout-content-width to initial restores the "no content width" default for LayoutHeader and LayoutFooter. In a 2400px frame at a 1280px viewport, their inner wrappers now measure 2400px instead of 1280px, and Layouts that set contentWidth or sit in narrower frames render unchanged.

  • Non-blocking: the new comment at Layout.tsx lines 82–85 says the alignment width is read only inside the middle row's query container and that contentWidth overrides both values; neither holds without a length contentWidth (inline suggestion attached).
  • Non-blocking: the description has no ## Writing rubric results section for the Layout.spec.md edit, which the contributing guide asks for whenever a record changes.

[Automated review]

Comment on lines +82 to +85
// A Layout without contentWidth caps no region: `initial` makes every
// var(--layout-content-width, none) fall back to none. The alignment width
// is read only inside the middle row's query container, where 100cqi is
// its own width. An explicit contentWidth overrides both on this node.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (comment accuracy): two statements here don't hold. LayoutContent applies its alignment calc in every Layout, and the middle row is a query container only when a length contentWidth is set (and not both panels); without one, the two 100cqi terms cancel at LayoutContent. A percentage, intrinsic or bare-variable contentWidth replaces only the content width. A version that keeps only the reasons:

// `initial` makes every var(--layout-content-width, none) fall back to none,
// so a Layout without contentWidth caps no region. LayoutContent subtracts the
// alignment width from its own 100cqi, so this value adds no gutter. A
// contentWidth on this node replaces the content width; a length one also
// replaces the alignment width.

@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 22:28
@cixzhang
cixzhang merged commit 0191e13 into main Nov 8, 2026
129 checks passed
@cixzhang
cixzhang deleted the fix/layout-content-width-default branch November 8, 2026 23:00

This branch was successfully deployed

1 active deployment
Preview — 827bf23a Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant