Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

spec(container-padding): AppShell is a boundary owner (#9461)

Cindy Zhanga986306fafbb
diff --git a/docs/architecture/container-padding.md b/docs/architecture/container-padding.md
index 54e5cb5205..eec8a4320b 100644
--- a/docs/architecture/container-padding.md
+++ b/docs/architecture/container-padding.md
@@ -29,6 +29,7 @@ applies_to:
packages/core/src/Table/,
packages/core/src/Toolbar/,
packages/core/src/Layer/,
+ packages/core/src/AppShell/,
]
verified_by:
[
@@ -41,6 +42,8 @@ verified_by:
packages/core/src/Layout/__tests__/edgeCompensation.test.tsx,
packages/core/src/List/List.test.tsx,
packages/core/src/TabList/TabList.test.tsx,
+ packages/core/src/AppShell/AppShell.test.tsx,
+ packages/core/src/AppShell/__tests__/AppShellLayoutRoot.interaction.browser.spec.ts,
]
deciding_specs: [spec:AST-002/DEC-1, spec:AST-002/DEC-2, spec:AST-025/DEC-2]
---
@@ -92,7 +95,10 @@ The protocol has four layers:
4. **Boundary reset.** An overlay leaves its ancestor's visual box while
remaining a DOM descendant. `overlayPaddingReset` zeroes values descendants
subtract and invalidates values descendants add, so readers fall through to
- their own defaults. It does not clear public theme properties.
+ their own defaults. It does not clear public theme properties. A layout
+ root ends the same inheritance where its own layout starts: AppShell applies
+ Layout's `layoutReset` at its root (`component:AppShell` FR18), which extends
+ `overlayPaddingReset` to the remaining Layout values (`component:Layout` FR8).
### Current and admitted publishers and consumers
@@ -103,7 +109,7 @@ The protocol has four layers:
| Bleed consumer | Section, ScrollableArea, Layout, Divider, Table, TabList, List | Subtract inherited inset on the edges each component is designed to escape; ScrollableArea does so only with `isFullBleed`, TabList and List only with `edge="bleed"` |
| Edge-compensation consumer | List/ListItem rows with `edge="outset"` | Move visible content toward the container content line while retaining component-owned interaction padding; exact alignment depends on each component's bounded geometry |
| Alignment consumer | Toolbar and edge-compensating child components | Read the current inline inset to align visible content rather than stacked touch-target padding |
-| Boundary owner | Layer surfaces and dialog-based overlay roots | Apply `overlayPaddingReset` before descendants read inherited page geometry |
+| Boundary owner | Layer surfaces and dialog-based overlay roots; AppShell's root | Apply `overlayPaddingReset`, or at AppShell's root Layout's `layoutReset`, before descendants read inherited page geometry |
The participant list is the shared container system, not a Layout-owned family:
Section and ScrollableArea publish content inset, Section and opt-in full-bleed
@@ -127,7 +133,8 @@ Edge compensation is a two-sided geometry contract, not a token contract:
1. **Host side.** An eligible container or region state publishes the padding
currently available at each logical edge through the existing private
`--container-padding-*` variables. Those values must match that state's
- applied padding and follow nesting and overlay reset; missing values mean zero.
+ applied padding and follow nesting and the overlay and layout-root resets;
+ missing values mean zero.
A state with a known publication mismatch is ineligible. Publication does not
itself opt a descendant into compensation.
2. **Component side.** A participating component owns the inset retained around
@@ -203,7 +210,7 @@ is decided.
| Participant | Source requirement | Canonical owner | Why it belongs | Done criteria | Status |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
-| Container and region publishers | The host owns the actual padding available at each logical edge | `architecture:container-padding` | A consumer cannot compensate safely without a per-edge upper bound from the host | Eligible states publish values matching applied padding, nesting, and overlay reset; missing values resolve to zero; known mismatch states remain excluded | current where conformant |
+| Container and region publishers | The host owns the actual padding available at each logical edge | `architecture:container-padding` | A consumer cannot compensate safely without a per-edge upper bound from the host | Eligible states publish values matching applied padding, nesting, and the overlay and layout-root resets; missing values resolve to zero; known mismatch states remain excluded | current where conformant |
| TabList / Tab | The strip moves its first and last visible tab content toward the host lines while retaining tab interaction padding, focus-ring room, overflow controls, its divider rail, and its selection indicator | `component:TabList` | The shipped behavior is `bleed` under the released name `isFullBleed` | Preserve bounded content movement, full host-inset consumption, divider span, overflow, clipping, scroll controls, indicator geometry, logical direction, compatibility, and defaults | current behavior; `edge="bleed"` canonical, alias pending |
| List / ListItem, using Item inset | An optional List header is not horizontally inset, while every row keeps Item's density- and theme-aware inline padding | `component:List` | The caller knows whether the List sits in a neutral container beside content that should share its logical content line, and whether its rows need room around their paint | `padded` unchanged by default; `outset` respects each row's own inset and the available host padding; `bleed` reaches the host's padding edge; header stays in place; required geometry evidence passes | current through `edge`; `edgeCompensation` deprecated |
| Button | An uncontained ghost Button may need its icon or label aligned while retaining its interaction inset | No current component projection | Its transparent interaction padding can create the same alignment need | Exclude filled and bordered presentations; prove composition, focus/hover paint, logical direction, and unchanged defaults; obtain owner approval | candidate only |
@@ -247,11 +254,14 @@ without dropping the active theme's Section default.
- **INV5 — Section propagation has narrower authority than theme defaults.** An
ancestor Section's explicit padding may propagate to nested Sections, but it
does not replace the public theme property and does not cross an overlay
- boundary.
-- **INV6 — Overlay boundaries terminate stale geometry.** The outermost styled
+ boundary or a layout root.
+- **INV6 — Overlay and layout-root boundaries terminate stale geometry.** The outermost styled
overlay root zeroes `--container-padding-*`, invalidates
`--layout-padding-*` and `--_section-padding-propagated`, and leaves public
- theme properties intact.
+ theme properties intact. AppShell's root is a layout root: it applies
+ Layout's `layoutReset`, which does the same and also resets the remaining
+ Layout values, so a padded host outside AppShell changes no geometry inside
+ it (`component:AppShell` FR18, `component:Layout` FR8).
- **INV7 — Composition keeps component ownership.** This protocol carries
geometry only. Section variants, Layout region semantics, Toolbar behavior,
Table structure, Divider presentation, and component theming remain with
@@ -323,8 +333,9 @@ evidence, not part of this documentation stack.
maintained examples to `edge`, and tests both paths before removal.
- Changing `container()` or the public-to-private padding lowering reviews Card,
Section, Dialog, BottomSheet, Layout regions, and overlay behavior together.
-- Changing overlay hosting or adding an overlay root verifies that stale page
- geometry stops at the new boundary without suppressing public theme values.
+- Changing overlay hosting or adding an overlay root or layout root verifies
+ that stale page geometry stops at the new boundary without suppressing public
+ theme values.
- A component other than BottomSheet that wants a new public full-bleed mode or
padding prop follows its component/family API review; this architecture does
not authorize that API. `component:List` owns List's `edge` projection,
@@ -348,6 +359,8 @@ evidence, not part of this documentation stack.
`edge` projection. `component:TabList` and `component:List` define their local
padding, row/strip geometry, and private propagation.
- Overlay roots — apply the reset at the visual boundary.
+- `packages/core/src/AppShell/AppShell.tsx` — applies Layout's `layoutReset` at
+ the shell's root.
## Deciding specs
@@ -365,16 +378,17 @@ evidence, not part of this documentation stack.
## Verification
-| Invariant | Evidence | Failure signal |
-| ---------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
-| INV2, INV5 | `Section.test.tsx` per-edge and nested-propagation tests | A per-edge prop leaves a stale geometry variable, or nested Sections lose the shipped propagation order |
-| INV2, INV3, INV8 | `ScrollableArea.test.tsx` padding and full-bleed tests | The content box publishes inset different from its applied padding, or the viewport escapes inherited padding without explicit full bleed |
-| INV4 | Layout source review plus `Layout.test.tsx` and `LayoutSlots.test.tsx` | Slot presence stops selecting the shipped applied outer/inner edge styles; exact republished geometry remains limited by the named conformance gap |
-| INV2 | `BottomSheetPanel.test.tsx` padding tests | The Content area publishes an inset that differs from its applied padding, or the `padding` prop or theme `padding` does not reach it |
-| INV6 | `overlayPaddingReset.test.tsx` | An overlay inherits page inset, loses its theme's Section padding, or lets ancestor Section propagation cross the boundary |
-| INV3, INV7 | `Layout/__tests__/edgeCompensation.test.tsx` plus component tests | An unmarked child is compensated, or marked edge content loses direct-child discoverability |
-| INV9, INV10 | `List.test.tsx` plus real-browser geometry evidence | The header moves; a row reads the wrong logical edge, diverges from themed/density padding, applies the wrong bounded movement, or loses paint inset |
-| INV10, INV11 | `TabList.test.tsx` plus real-browser overflow, divider, and indicator evidence | Full host-inset consumption, bounded content movement, divider span, interaction, focus, overflow, scroll controls, or indicator geometry regresses |
+| Invariant | Evidence | Failure signal |
+| ---------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| INV2, INV5 | `Section.test.tsx` per-edge and nested-propagation tests | A per-edge prop leaves a stale geometry variable, or nested Sections lose the shipped propagation order |
+| INV2, INV3, INV8 | `ScrollableArea.test.tsx` padding and full-bleed tests | The content box publishes inset different from its applied padding, or the viewport escapes inherited padding without explicit full bleed |
+| INV4 | Layout source review plus `Layout.test.tsx` and `LayoutSlots.test.tsx` | Slot presence stops selecting the shipped applied outer/inner edge styles; exact republished geometry remains limited by the named conformance gap |
+| INV2 | `BottomSheetPanel.test.tsx` padding tests | The Content area publishes an inset that differs from its applied padding, or the `padding` prop or theme `padding` does not reach it |
+| INV6 | `overlayPaddingReset.test.tsx` | An overlay inherits page inset, loses its theme's Section padding, or lets ancestor Section propagation cross the boundary |
+| INV5, INV6 | `AppShellLayoutRoot.interaction.browser.spec.ts` and the `AppShell.test.tsx` "AppShell layout root (FR18)" suite | AppShell's regions inside a padded Card, Section, or Layout differ from its page-root render, or a reset value or context leaks into the shell |
+| INV3, INV7 | `Layout/__tests__/edgeCompensation.test.tsx` plus component tests | An unmarked child is compensated, or marked edge content loses direct-child discoverability |
+| INV9, INV10 | `List.test.tsx` plus real-browser geometry evidence | The header moves; a row reads the wrong logical edge, diverges from themed/density padding, applies the wrong bounded movement, or loses paint inset |
+| INV10, INV11 | `TabList.test.tsx` plus real-browser overflow, divider, and indicator evidence | Full host-inset consumption, bounded content movement, divider span, interaction, focus, overflow, scroll controls, or indicator geometry regresses |
The List evidence must cover each `edge` value in its neutral root and in each
bounded host List admits (Card, Section, Dialog, BottomSheet), with the optional
diff --git a/docs/specs/components/Section/Section.spec.md b/docs/specs/components/Section/Section.spec.md
index d7d9458f60..23b0528c53 100644
--- a/docs/specs/components/Section/Section.spec.md
+++ b/docs/specs/components/Section/Section.spec.md
@@ -13,6 +13,8 @@ review_triggers: [public-api, layout, theming, accessibility]
verified_by:
[
packages/core/src/Layout/overlayPaddingReset.test.tsx,
+ packages/core/src/Layout/layoutReset.test.tsx,
+ packages/core/src/AppShell/AppShell.test.tsx,
.github/visual-baseline/manifest.json,
packages/core/src/serverSafeComponents.test.ts,
packages/core/src/Section/Section.test.tsx,
@@ -99,13 +101,13 @@ Consumer migration instructions belong in consumer docs and release notes.
## Behavioral and layout contract
-| ID | Invariant | Basis |
-| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
-| FR1 | Section renders an outer `div` wrapper holding an inner `div` that carries the `section` target, reflects `variant`, and holds the children. The inner container fills the wrapper's height. Implementation gap: it fills only a set `height`; under `minHeight` alone the painted container stays at its content height inside a taller wrapper (Current-state impact). | Current source and tests |
-| FR2 | `section` paints `--color-background-surface`, `transparent` paints nothing, and `muted` paints `--color-background-muted`; a theme-added variant with no matching theme rule paints no background and still reflects `data-variant` (`architecture:component-theming-surface` INV14). Each selected divider draws a 1px solid `--color-border` border on that edge; `start` and `end` are logical inline edges. | Current source and tests |
-| FR3 | An omitted `padding` resolves per edge from the theme's per-edge and per-axis section padding, then the nearest ancestor Section's explicit `padding`, then the theme's single section padding, then spacing step 4. A step sets uniform padding and publishes it as the container-padding variables for descendants, and nested Sections without `padding` inherit it, except across an overlay boundary, where the inherited value stops (`architecture:container-padding` INV5). `paddingInline` and `paddingBlock` override one axis, and an edge prop overrides its edge alone; each override moves the matching container-padding variable. | Current source, tests, and family record |
-| FR4 | The wrapper escapes its parent's published container padding: always on both inline edges, and on the block-start edge only as a first child and the block-end edge only as a last child. The inner container resets the inherited padding variables before publishing its own. | Current source and family record |
-| FR5 | `ref`, `className`, `style`, `xstyle`, sizing, and DOM, data, ARIA, and event props reach the outer wrapper; numbers in sizing props are pixels. The inner painted container takes none of them; Toolbar relies on the wrapper routing. | Current source and tests |
+| ID | Invariant | Basis |
+| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
+| FR1 | Section renders an outer `div` wrapper holding an inner `div` that carries the `section` target, reflects `variant`, and holds the children. The inner container fills the wrapper's height. Implementation gap: it fills only a set `height`; under `minHeight` alone the painted container stays at its content height inside a taller wrapper (Current-state impact). | Current source and tests |
+| FR2 | `section` paints `--color-background-surface`, `transparent` paints nothing, and `muted` paints `--color-background-muted`; a theme-added variant with no matching theme rule paints no background and still reflects `data-variant` (`architecture:component-theming-surface` INV14). Each selected divider draws a 1px solid `--color-border` border on that edge; `start` and `end` are logical inline edges. | Current source and tests |
+| FR3 | An omitted `padding` resolves per edge from the theme's per-edge and per-axis section padding, then the nearest ancestor Section's explicit `padding`, then the theme's single section padding, then spacing step 4. A step sets uniform padding and publishes it as the container-padding variables for descendants, and nested Sections without `padding` inherit it, except across an overlay boundary or a layout root, such as AppShell's root, where the inherited value stops (`architecture:container-padding` INV5, `component:AppShell` FR18, `component:Layout` FR8). `paddingInline` and `paddingBlock` override one axis, and an edge prop overrides its edge alone; each override moves the matching container-padding variable. | Current source, tests, and family record |
+| FR4 | The wrapper escapes its parent's published container padding: always on both inline edges, and on the block-start edge only as a first child and the block-end edge only as a last child. The inner container resets the inherited padding variables before publishing its own. | Current source and family record |
+| FR5 | `ref`, `className`, `style`, `xstyle`, sizing, and DOM, data, ARIA, and event props reach the outer wrapper; numbers in sizing props are pixels. The inner painted container takes none of them; Toolbar relies on the wrapper routing. | Current source and tests |
### Allowed variation
@@ -126,7 +128,8 @@ Consumer migration instructions belong in consumer docs and release notes.
- **ORD1 — Padding per edge.** Edge prop → axis prop → `padding` → theme
per-edge and per-axis section padding → nearest ancestor Section's explicit
- `padding`, not across an overlay boundary → theme single section padding → spacing step 4.
+ `padding`, not across an overlay boundary or a layout root → theme single
+ section padding → spacing step 4.
### Performance and resources
@@ -174,14 +177,14 @@ The outer wrapper is implementation structure and carries no target.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
-| FR1, FR2 | `Section.test.tsx` structure and variant tests; stable visual baseline `core-section--default` | Variants; default section | A lost two-div structure, a lost `section` target on the inner `div`, or a lost variant reflection fails; a changed default surface comes back changed for review. Gap: the divider test asserts only that content renders, so divider borders and the `transparent` and `muted` paint have no automated check, and no check asserts the inner container fills the wrapper's height, including the `minHeight` gap. A theme-added variant with no matching rule also has no focused test. | `audit:Section/anatomy` |
-| FR3, ORD1 | `Section.test.tsx` padding, propagation, and edge-override tests; `overlayPaddingReset.test.tsx`; `Section.stories.tsx` NestedPaddingInheritance | Uniform, axis, edge, nested | Axis-as-two-edges drift, edge over axis on the end edges, a lost propagated value for nested Sections, an ancestor Section's padding that crosses an overlay boundary, or a container variable (inline or block) that does not move with an edge override fails. Gap: edge over axis on the start edges, axis over uniform, the theme per-edge and per-axis padding ahead of the inherited value, and a variable that stops moving on both the axis and edge paths have no check. | `audit:Section/layout` |
-| FR4 | `Section.stories.tsx` nested fixtures in a browser | Nested sections | Gap: no unit test asserts the escape margins; a lost escape is visible in the rendered fixture. | `audit:Section/layout` |
-| FR5 | `Section.test.tsx` ref, className, style, and passthrough tests | Caller inputs | A `className` or `style` that misses the outer wrapper, or a dropped `data-testid`, fails. Gap: the ref test accepts either `div`, the passthrough test finds `data-testid` anywhere in the tree so the routing of DOM, data, ARIA, and event props has no check, and the sizing and `xstyle` tests assert only that content renders. | `audit:Section/api` |
-| AR1, PR1 | `serverSafeComponents.test.ts`; source review | Every state | A client API (state, a hook) added without a client directive fails `serverSafeComponents.test.ts`. Gap: a client API added together with a client directive passes, and no automated check fails if Section adds a role, name, landmark, or tab stop. | `audit:Section/a11y` |
-| Theming anatomy map | `scripts/check-knowledge.mjs` | Consumer anatomy and current target | Missing, extra, or stale mappings fail repository validation. | `audit:Section/theming` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
+| FR1, FR2 | `Section.test.tsx` structure and variant tests; stable visual baseline `core-section--default` | Variants; default section | A lost two-div structure, a lost `section` target on the inner `div`, or a lost variant reflection fails; a changed default surface comes back changed for review. Gap: the divider test asserts only that content renders, so divider borders and the `transparent` and `muted` paint have no automated check, and no check asserts the inner container fills the wrapper's height, including the `minHeight` gap. A theme-added variant with no matching rule also has no focused test. | `audit:Section/anatomy` |
+| FR3, ORD1 | `Section.test.tsx` padding, propagation, and edge-override tests; `overlayPaddingReset.test.tsx`; `layoutReset.test.tsx`; the `AppShell.test.tsx` "AppShell layout root (FR18)" suite; `Section.stories.tsx` NestedPaddingInheritance | Uniform, axis, edge, nested; inside an overlay; AppShell inside a padded Section | Axis-as-two-edges drift, edge over axis on the end edges, a lost propagated value for nested Sections, an ancestor Section's padding that crosses an overlay boundary or a layout root, or a container variable (inline or block) that does not move with an edge override fails. Gap: edge over axis on the start edges, axis over uniform, the theme per-edge and per-axis padding ahead of the inherited value, and a variable that stops moving on both the axis and edge paths have no check. | `audit:Section/layout` |
+| FR4 | `Section.stories.tsx` nested fixtures in a browser | Nested sections | Gap: no unit test asserts the escape margins; a lost escape is visible in the rendered fixture. | `audit:Section/layout` |
+| FR5 | `Section.test.tsx` ref, className, style, and passthrough tests | Caller inputs | A `className` or `style` that misses the outer wrapper, or a dropped `data-testid`, fails. Gap: the ref test accepts either `div`, the passthrough test finds `data-testid` anywhere in the tree so the routing of DOM, data, ARIA, and event props has no check, and the sizing and `xstyle` tests assert only that content renders. | `audit:Section/api` |
+| AR1, PR1 | `serverSafeComponents.test.ts`; source review | Every state | A client API (state, a hook) added without a client directive fails `serverSafeComponents.test.ts`. Gap: a client API added together with a client directive passes, and no automated check fails if Section adds a role, name, landmark, or tab stop. | `audit:Section/a11y` |
+| Theming anatomy map | `scripts/check-knowledge.mjs` | Consumer anatomy and current target | Missing, extra, or stale mappings fail repository validation. | `audit:Section/theming` |
## Decision log