An open source design system that's fully customizable and agent ready
TypeScript
fix(Layout): a full-bleed Table or List row takes the rounded container corner it reaches (#10586)
Cindy Zhang17f6985edbee
diff --git a/.changeset/container-corners.md b/.changeset/container-corners.mdnew file mode 100644index 0000000000..a79ced5f57--- /dev/null+++ b/.changeset/container-corners.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] A Table, or a List with `edge="bleed"`, that is the first or last child of a rounded Card or Dialog that holds no other Table or bleeding List deeper inside now rounds with the corner it reaches, so the table's focus ring stays whole at the container's corners instead of being cut off. A bleeding List with a header rounds only its last row. Every other corner stays square: standalone, inside a square container or a wrapper element, between other content, at the top of a BottomSheet (below its grab bar), or while another Table or bleeding List sits deeper in the same container.++@cixzhangdiff --git a/apps/storybook/stories/ContainerCorners.stories.tsx b/apps/storybook/stories/ContainerCorners.stories.tsxnew file mode 100644index 0000000000..f0667afeed--- /dev/null+++ b/apps/storybook/stories/ContainerCorners.stories.tsx@@ -0,0 +1,231 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file ContainerCorners.stories.tsx+ * @input Card, Dialog, BottomSheet, Section, Table, and List+ * @output Stories where a full-bleed child meets, or stops short of, a+ * rounded container corner+ * @position Storybook evidence for container corner geometry. The+ * ContainerCorners Chromium spec reads these stories.+ */++import {useState} from 'react';+import type {Meta, StoryObj} from '@storybook/react';+import {BottomSheet} from '@astryxdesign/core/BottomSheet';+import {Card} from '@astryxdesign/core/Card';+import {Dialog} from '@astryxdesign/core/Dialog';+import {List, ListItem} from '@astryxdesign/core/List';+import {Section} from '@astryxdesign/core/Section';+import {Table} from '@astryxdesign/core/Table';+import type {TableColumn} from '@astryxdesign/core/Table';+import {Text} from '@astryxdesign/core/Text';++const meta: Meta = {+ title: 'Core/ContainerCorners',+ parameters: {layout: 'padded'},+};++export default meta;+type Story = StoryObj;++interface Order extends Record<string, unknown> {+ id: string;+ customer: string;+ item: string;+ quantity: string;+ warehouse: string;+ carrier: string;+ status: string;+ email: string;+ tracking: string;+}++const orders: Order[] = [+ {+ id: '1',+ customer: 'Alice Johnson',+ item: 'Standing desk',+ quantity: '1',+ warehouse: 'Oakland',+ carrier: 'Ground',+ status: 'Shipped',+ email: '[email protected]',+ tracking: '1Z999AA10123456784',+ },+ {+ id: '2',+ customer: 'Bob Martinez',+ item: 'Monitor arm',+ quantity: '2',+ warehouse: 'Reno',+ carrier: 'Express',+ status: 'Packing',+ email: '[email protected]',+ tracking: '1Z999AA10123456785',+ },+ {+ id: '3',+ customer: 'Chen Wei',+ item: 'Desk lamp',+ quantity: '4',+ warehouse: 'Oakland',+ carrier: 'Ground',+ status: 'Delivered',+ email: '[email protected]',+ tracking: '1Z999AA10123456786',+ },+];++// Enough columns that the table scrolls inline in a narrow card, so its+// scroll region is a tab stop with a focus ring.+const orderColumns: TableColumn<Order>[] = [+ {key: 'customer', header: 'Customer'},+ {key: 'item', header: 'Item'},+ {key: 'quantity', header: 'Quantity'},+ {key: 'warehouse', header: 'Warehouse'},+ {key: 'carrier', header: 'Carrier'},+ {key: 'status', header: 'Status'},+ {key: 'email', header: 'Email'},+ {key: 'tracking', header: 'Tracking number'},+];++function OrdersTable() {+ return (+ <Table+ data={orders}+ columns={orderColumns}+ idKey="id"+ dividers="rows"+ density="compact"+ textOverflow="truncate"+ aria-label="Orders"+ />+ );+}++const rows = ['Inbox', 'Drafts', 'Sent', 'Archive'];++function BleedList() {+ return (+ <List edge="bleed" hasDividers>+ {rows.map(label => (+ <ListItem key={label} label={label} onClick={() => {}} />+ ))}+ </List>+ );+}++/** A table fills a Card and reaches all four of its corners. */+export const TableInCard: Story = {+ render: () => (+ <div style={{width: 360}}>+ <Card>+ <OrdersTable />+ </Card>+ </div>+ ),+};++/**+ * Text sits above the table, so the card's top padding stays between the+ * table and the top corners: only the bottom corners are reached.+ */+export const TableAfterTextInCard: Story = {+ render: () => (+ <div style={{width: 360}}>+ <Card>+ <Text>Open orders</Text>+ <OrdersTable />+ </Card>+ </div>+ ),+};++/** A Section is a square container: a table inside it reaches no corner. */+export const TableInSectionInCard: Story = {+ render: () => (+ <div style={{width: 360}}>+ <Card>+ <Section>+ <OrdersTable />+ </Section>+ </Card>+ </div>+ ),+};++/**+ * A Dialog with no padding: the bleeding list's first and last rows touch+ * the dialog's corners.+ */+export const BleedListInDialog: Story = {+ render: () => (+ <Dialog isOpen isInline onOpenChange={() => {}} width={360} padding={0}>+ <BleedList />+ </Dialog>+ ),+};++/**+ * A Dialog with no padding, with the table between two lines of text: the+ * table reaches no corner, so it stays square.+ */+export const TableBetweenTextInDialog: Story = {+ render: () => (+ <Dialog isOpen isInline onOpenChange={() => {}} width={360} padding={0}>+ <Text>Open orders</Text>+ <OrdersTable />+ <Text>Three open orders.</Text>+ </Dialog>+ ),+};++/**+ * A Dialog with no padding, with the bleeding list inside a wrapper element+ * below a heading: the list is not the dialog's own child, so its rows stay+ * square.+ */+export const WrappedBleedListInDialog: Story = {+ render: () => (+ <Dialog isOpen isInline onOpenChange={() => {}} width={360} padding={0}>+ <Text>Folders</Text>+ <div>+ <BleedList />+ </div>+ </Dialog>+ ),+};++/**+ * The card's block padding is larger than its corner radius, so the+ * bleeding list's rows stay square.+ */+export const BleedListInCard: Story = {+ render: () => (+ <div style={{width: 360}}>+ <Card>+ <BleedList />+ </Card>+ </div>+ ),+};++/**+ * A table at the top of a bottom sheet starts below the grab bar's band, so it+ * reaches no corner and stays square.+ */+export const TableInBottomSheet: Story = {+ render: () => {+ const [isOpen, setIsOpen] = useState(true);+ return (+ <BottomSheet+ isOpen={isOpen}+ onOpenChange={setIsOpen}+ label="Orders"+ height="hug">+ <OrdersTable />+ <Text>Three open orders.</Text>+ </BottomSheet>+ );+ },+};diff --git a/docs/architecture/container-padding.md b/docs/architecture/container-padding.mdindex 35d9650152..3ffb11986f 100644--- a/docs/architecture/container-padding.md+++ b/docs/architecture/container-padding.md@@ -12,6 +12,7 @@ owners: [cixzhang, imdreamrunner]applies_to:[packages/core/src/Layout/container.stylex.ts,+ packages/core/src/Layout/containerCorners.stylex.ts,packages/core/src/Layout/padding.stylex.ts,packages/core/src/Layout/edgeCompensation.stylex.ts,packages/core/src/Card/,@@ -44,6 +45,7 @@ verified_by:packages/core/src/TabList/TabList.test.tsx,packages/core/src/AppShell/AppShell.test.tsx,packages/core/src/AppShell/__tests__/AppShellLayoutRoot.interaction.browser.spec.ts,+ packages/core/src/Layout/__tests__/ContainerCorners.a11y.chromium.spec.ts,]deciding_specs: [spec:AST-002/DEC-1, spec:AST-002/DEC-2, spec:AST-025/DEC-2]---@@ -56,7 +58,16 @@ deciding_specs: [spec:AST-002/DEC-1, spec:AST-002/DEC-2, spec:AST-025/DEC-2]{"scope": "global","triggers": {- "layout": ["INV1", "INV3", "INV6", "INV8", "INV9", "INV10", "INV11"],+ "layout": [+ "INV1",+ "INV3",+ "INV6",+ "INV8",+ "INV9",+ "INV10",+ "INV11",+ "INV12"+ ],"public-api": ["INV3", "INV7", "INV9", "INV10", "INV11"]}}@@ -65,8 +76,9 @@ deciding_specs: [spec:AST-002/DEC-1, spec:AST-002/DEC-2, spec:AST-025/DEC-2]## PurposePadded containers and their descendants need one shared account of the inset at-each logical edge. Without it, a full-bleed child cannot cancel the padding it-actually received, a nested region cannot preserve one content line, and an+each logical edge, and of the corner radius at each logical corner. Without it,+a full-bleed child cannot cancel the padding it actually received or follow the+corner it reaches, a nested region cannot preserve one content line, and anoverlay can inherit geometry from a visual box it no longer occupies.This record describes the shared internal protocol. It does not make its CSS@@ -86,7 +98,9 @@ The protocol has four layers:component padding prop may publish the same geometry through the maps in`padding.stylex.ts`.3. **Descendant geometry.** Four inherited `--container-padding-*` variables- carry the inset that bleed descendants subtract. Container publishers and+ carry the inset that bleed descendants subtract, and four inherited+ `--container-corner-*` variables carry the corner radius they take where+ they reach a corner (see Corner geometry below). Container publishers andexplicit region-padding paths couple those variables to their padding.Layout also carries an outer/inner split through`--layout-padding-outer-*` and `--layout-padding-inner-*`; automatic region@@ -94,7 +108,7 @@ The protocol has four layers:resulting edge exactly (see the conformance gap below).4. **Boundary reset.** An overlay leaves its ancestor's visual box whileremaining a DOM descendant. `overlayPaddingReset` zeroes values descendants- subtract and invalidates values descendants add, so readers fall through to+ subtract or take as a corner and invalidates values descendants add, so readers fall through totheir own defaults. It does not clear public theme properties. A layoutroot ends the same inheritance where its own layout starts: AppShell appliesLayout's `layoutReset` at its root (`component:AppShell` FR18), which extends@@ -233,6 +247,49 @@ This record adds no EdgeAlignment wrapper or new token vocabulary. Existingcontainer-padding participation remains the single host provider, and eachcomponent contract owns its local retained inset and public projection.+### Corner geometry++A full-bleed child that reaches a rounded container's corner takes that corner,+so its own corner, its focus ring, and its fills follow the container's curve+instead of being cut by the container's clip. The container publishes its+corners through four inherited `--container-corner-*` variables, one for each+logical corner: `start-start`, `start-end`, `end-start`, and `end-end`, in the+order of the logical `border-radius` properties. A missing value means a square+corner.++A child that reads corners marks itself with `data-container-corner`. A+rounded container publishes its block-start corners only while a reader is its+first child, and its block-end corners only while a reader is its last child.+It publishes no corner while any reader sits deeper inside it, because such a+reader could take a corner it does not reach. A reader therefore takes a corner+only as the direct child of the container that publishes it.++| Host | Published corners |+| ----------- | --------------------------------------------------------------------------------------------------------------- |+| Card | Its radius. Its full-bleed child reaches under the border, so this is the outer radius |+| Dialog | Its radius; 0 when full screen |+| BottomSheet | None: its content keeps the grab bar's band at the top, so a full-bleed child never reaches the sheet's corners |+| Every other | None |++A reader takes a corner only where its bleed reaches it. At each corner its+radius is the published corner less the padding it keeps on the block edge that+meets there, and never less than 0:++- Table's scroll region bleeds on a block edge only as its container's first or+ last child. There it takes the full corner; every other corner is 0.+- A List with `edge="bleed"` keeps the host's block padding. Its first row takes+ the block-start corners less that padding when the list is its container's+ first child; its last row takes the block-end corners less the block-end+ padding when the list is the last child. With a header, the list's root is+ the container's child and the header sits above the first row, so only the+ last row can take a corner. Every other row corner is 0.++Reading corners is part of a component's bleed contract (INV3): a component+that does not consume bleed reads no corner, and standalone, inside a square+container, inside a wrapper element, or between other content every corner+resolves to 0. Popover, menus, and other surfaces that are not container+publishers are outside this geometry.+`--_section-padding-propagated` is separate from the public`--astryx-section-padding` property. The private value carries one ancestorSection's explicit padding. An overlay can therefore drop ancestor geometry@@ -241,8 +298,8 @@ without dropping the active theme's Section default.## Boundaries and invariants- **INV1 — Internal geometry is not theme API.** `--container-padding-*`,- `--layout-padding-*`, and `--_section-padding-propagated` are implementation- protocol. Themes use documented component properties instead of setting or+ `--container-corner-*`, `--layout-padding-*`, and+ `--_section-padding-propagated` are implementation protocol. Themes use documented component properties instead of setting ordepending on these names.- **INV2 — Coupled publication paths stay coupled.** Where current sourcepublishes geometry alongside a padding declaration—container lowering,@@ -263,7 +320,7 @@ without dropping the active theme's Section default.does not replace the public theme property and does not cross an overlayboundary or a layout root.- **INV6 — Overlay and layout-root boundaries terminate stale geometry.** The outermost styled- overlay root zeroes `--container-padding-*`, invalidates+ overlay root zeroes `--container-padding-*` and `--container-corner-*`, invalidates`--layout-padding-*` and `--_section-padding-propagated`, and leaves publictheme properties intact. AppShell's root is a layout root: it appliesLayout's `layoutReset`, which does the same and also resets the remaining@@ -301,6 +358,13 @@ without dropping the active theme's Section default.and arbitrary consumer CSS that changes a component's padding is outside theshared alignment guarantee.+- **INV12 — A corner reaches only a direct reader.** A rounded padding+ publisher publishes its corners from the radius that draws its own corner,+ on the element that publishes its padding. It publishes a corner only to a+ reader that is its first or last child at that block edge, and none while a+ reader sits deeper inside it. A reader takes a corner only where its bleed+ reaches that edge. Every other element publishes no corner.+### Known conformance gapLayoutPanel does not currently publish the padding it applies on every@@ -315,6 +379,11 @@ covers every slot and descendant-bleed combination, so this record does not claiexact region parity. Correcting the mismatch is runtime work with compatibilityevidence.+## Current-state impact++- **BottomSheet corners.** BottomSheet publishes no corner: its grab-bar band+ sits above the content, so no content child meets the sheet's corner.+## Change coupling- Changing a publisher's padding precedence, logical edges, or container vars@@ -334,6 +403,9 @@ evidence.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 a rounded publisher's radius source, or adding a rounded publisher+ or a corner reader, updates the corner publication, the reader mark, and the+ corner evidence together (INV12).- Changing overlay hosting or adding an overlay root or layout root verifiesthat stale page geometry stops at the new boundary without suppressing publictheme values.@@ -348,6 +420,8 @@ evidence.- `packages/core/src/Layout/container.stylex.ts` — lowers container theme andexplicit padding into internal geometry.+- `packages/core/src/Layout/containerCorners.stylex.ts` — holds the one corner+ publication rounded hosts share; the package does not export it.- `packages/core/src/Layout/padding.stylex.ts` — owns public spacing-step maps,logical-edge setters, Section propagation, and the overlay reset.- `packages/core/src/Layout/edgeCompensation.stylex.ts` — owns the container-side@@ -359,6 +433,10 @@ evidence.- TabList currently lowers its component-owned projection; List lowers its`edge` projection. `component:TabList` and `component:List` define their localpadding, row/strip geometry, and private propagation.+- Card and Dialog implementations — set the radius at each block edge for the+ shared corner publication.+- Table and List implementations — mark themselves as readers and take the+ corners they reach.- Overlay roots — apply the reset at the visual boundary.- `packages/core/src/AppShell/AppShell.tsx` — applies Layout's `layoutReset` atthe shell's root.@@ -379,17 +457,18 @@ evidence.## 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 on any edge but the block start, its block start publishes more than the padding past the grab bar's band, 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 |+| 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 on any edge but the block start, its block start publishes more than the padding past the grab bar's band, 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 |+| INV3, INV12 | `ContainerCorners.a11y.chromium.spec.ts` | A Table or bleeding List row that is a Card's or Dialog's first or last child stays square, or its ring is cut at the corner; or a reader between other content, inside a wrapper, past the container's padding, or below a BottomSheet's grab bar rounds |The List evidence must cover each `edge` value in its neutral root and in eachbounded host List admits (Card, Section, Dialog, BottomSheet), with the optionaldiff --git a/docs/specs/components/List/List.spec.md b/docs/specs/components/List/List.spec.mdindex 5f9e3ce2db..51d0d6f2f8 100644--- a/docs/specs/components/List/List.spec.md+++ b/docs/specs/components/List/List.spec.md@@ -132,7 +132,7 @@ Consumer migration instructions belong in consumer docs and release notes.| FR2 | `padded` MUST preserve current header, list, and row geometry, apart from FR10's hit target under a coarse pointer. No treatment MAY move the header or change row block padding, gap, markers, start and end content, semantics, or hit target relative to the row box. | Owner direction | Accepted contract || FR3 | `flush` MUST resolve each row's inline inset to zero through the private source that supplies Item's applied inline padding, so row content and row paint share the list's inline edges. It reads no host padding. A theme override of row inline padding takes precedence over the zero (FR7). | `component:List/DEC-3` | Accepted contract || FR4 | `outset` MUST place each row so it reaches past the host content line by the smaller of its own inline inset and the matching host inset, per logical edge, keeping its inset inside. Content reaches the host line when the host inset is at least the row inset. | `architecture:container-padding/INV9–INV10`; `component:List/DEC-2` | Accepted contract |-| FR5 | `bleed` MUST place each row so it reaches the host's padding edge on each logical edge, with square corners. Row content sits on the host content line, or at the row's own inset from its edge when the host inset is smaller. A theme override of row inline padding sets the content's inset instead (FR7). | `architecture:container-padding/INV3`; `component:List/DEC-4` | Accepted contract |+| FR5 | `bleed` MUST place each row so it reaches the host's padding edge on each logical edge, with square corners, except that, when the list is a rounded host's first or last child, its first or last row takes that host's corner less the host block padding it keeps (`architecture:container-padding` Corner geometry). Row content sits on the host content line, or at the row's own inset from its edge when the host inset is smaller. A theme override of row inline padding sets the content's inset instead (FR7). | `architecture:container-padding/INV3`; `component:List/DEC-4` | Accepted contract || FR6 | Missing or reset host inset MUST resolve to zero, so `outset` and `bleed` place content as `padded` does outside a padded host. No row paint MAY reach past the host's padding edge. | `architecture:container-padding/INV6`, `INV9` | Accepted contract || FR7 | Each row's retained inset MUST come from the same private density- and theme-derived source as Item's applied inline padding. A theme `item.paddingInline` override takes precedence over every treatment's row padding, as it does over density. A consumer override of row padding through `xstyle`, `className`, or `style` is outside the alignment guarantee. | Shared two-owner geometry contract | Accepted contract || FR8 | `outset` and `bleed` are valid only under a host state whose published inline inset matches its applied padding: a visually neutral host, such as a Layout region with explicit padding or a padded ScrollableArea, or the content area of a Card, Section (any variant), Dialog, or BottomSheet. Those hosts bound their padding with a border, background, or clip; FR6 keeps row paint inside the padding edge, so it never covers the border or changes the host's outline. Automatic LayoutContent/LayoutPanel states with a known publication mismatch are not eligible until that gap is fixed, and Drawer's content area is not admitted until it has its own evidence. | `architecture:container-padding/INV8–INV11`; real-browser evidence in each admitted host | Accepted contract |@@ -296,8 +296,10 @@ request two treatments at once.**Decider:** cixzhang, 2026-10-15`bleed` matches Table rows in a padded host: row paint reaches the host's padding-edge with square corners, and content sits on the host content line, never closer-to the row edge than the row's own inset. It is opt-in, so existing lists keep+edge with square corners, except that, when the list is a rounded host's first or+last child, its first or last row takes that host's corner less the host block+padding it keeps (FR5). Content sits on the host content line, never closer to the+row edge than the row's own inset. It is opt-in, so existing lists keeptheir geometry.Rejected: bleed as the default inside padded hosts, because it would move everydiff --git a/docs/specs/components/List/ListItem.spec.md b/docs/specs/components/List/ListItem.spec.mdindex 8ab0bb88cd..06eb5e0a31 100644--- a/docs/specs/components/List/ListItem.spec.md+++ b/docs/specs/components/List/ListItem.spec.md@@ -116,7 +116,7 @@ No component-local concept beyond the consumer props; row props are| ID | Invariant | Basis || --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ || FR1 | ListItem renders `component:Item` as an `<li>` and passes `label`, `description`, `startContent`, `endContent`, `onClick`, `interactiveRef`, `href`, `target`, `rel`, `align`, `isDisabled`, `isSelected`, `swipe`, the deprecated `swipeActions` and `swipeBehavior` (`spec:AST-057` DEP-0017), and `ref` to it unchanged, with other DOM and data props reaching the row. | Current source and tests |-| FR2 | Inside a List, the row takes the list's `density`, its `hasDividers` setting, which draws a divider between rows with no extra element and square corners, and its `edge` treatment. | Current source and tests |+| FR2 | Inside a List, the row takes the list's `density`, its `hasDividers` setting, which draws a divider between rows with no extra element and square corners (except that a `bleed` list's first or last row takes a rounded host's corner, `component:List` FR5), and its `edge` treatment. | Current source and tests || FR3 | Outside a List, the row uses `balanced` density, no dividers, the `padded` treatment, and no marker, keeping Item's inline inset. | Current source and tests || FR4 | In a List whose `listStyle` is `disc`, `circle`, or `decimal`, the row draws that marker before its content: a disc or circle shape, or a counter number. A task state set for the row draws a read-only, labelled checkbox in the marker's place. Each marker and the task checkbox sit on the label's first line. A List whose `listStyle` is `none` draws neither. Other markers, set internally for Markdown's nested lists, are uncontracted here. | Current source and tests || FR5 | The row carries `component:List`'s `list-item` target, merged with the caller's `className` and `style`; `xstyle` applies after ListItem's own styles. | Current source |@@ -128,14 +128,14 @@ No component-local concept beyond the consumer props; row props are### Representative states-| State | Required invariant | Allowed variation |-| -------------------- | ------------------------------------------------ | ----------------- |-| Static row in a List | One `<li>`; no button or anchor. | Content. |-| Interactive row | Item's invisible button or anchor; one tab stop. | Content. |-| Divided list | A divider between rows; square corners. | Density. |-| Numbered list | A counter number before each row. | Number style. |-| Task row | A read-only checkbox in the marker's place. | Checked state. |-| Row outside a List | Item's inline inset; no marker. | Content. |+| State | Required invariant | Allowed variation |+| -------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------- |+| Static row in a List | One `<li>`; no button or anchor. | Content. |+| Interactive row | Item's invisible button or anchor; one tab stop. | Content. |+| Divided list | A divider between rows; square corners, except a `bleed` list's end rows in a rounded host (`component:List` FR5). | Density. |+| Numbered list | A counter number before each row. | Number style. |+| Task row | A read-only checkbox in the marker's place. | Checked state. |+| Row outside a List | Item's inline inset; no marker. | Content. |### Transformation and precedence order@@ -192,7 +192,7 @@ migration, so the map is deferred.Read from source, with no focused test yet:- FR1: `interactiveRef`, `rel`, and `ref` reaching the Item row.-- FR2: the divider border and square corners.+- FR2: the divider border and square corners. The `bleed` end-row corner exception is checked by `ContainerCorners.a11y.chromium.spec.ts` (`component:List` FR5).- FR4: each marker and the task checkbox sitting on the label's first line.- FR3: `balanced` density, no dividers, and no marker outside a List.- FR4: the shape of each bullet marker (the disc's fill, the circle's ring),diff --git a/packages/core/src/Card/Card.tsx b/packages/core/src/Card/Card.tsxindex 52f4f3f833..66960eeca0 100644--- a/packages/core/src/Card/Card.tsx+++ b/packages/core/src/Card/Card.tsx@@ -23,6 +23,7 @@ import {shadowVars,} from '../theme/tokens.stylex';import {container} from '../Layout/container.stylex';+import {containerCornerStyles} from '../Layout/containerCorners.stylex';import type {SpacingToken} from '../Layout/container.stylex';import {spacingStepToToken} from '../Layout/padding.stylex';import type {Elevation, SizeValue, SpacingStep} from '../utils/types';@@ -91,6 +92,11 @@ const styles = stylex.create({paddingBlockStart: `calc(var(--container-padding-block-start) - ${borderVars['--border-width']})`,paddingBlockEnd: `calc(var(--container-padding-block-end) - ${borderVars['--border-width']})`,},+ // A full-bleed child reaches under the border, so it takes the outer radius.+ corners: {+ '--_container-corner-block-start': 'var(--_card-radius)',+ '--_container-corner-block-end': 'var(--_card-radius)',+ },// Fixed-height cards scroll content; overflow: auto also clips to border-radiusscrollable: {overflow: 'auto',@@ -322,6 +328,8 @@ export function Card({paddingOuterY: paddingToken,},),+ styles.corners,+ containerCornerStyles.publish,// Applied after the container padding so the border-inset calc wins;// it reads the --container-padding-* vars set above.variant === 'default' && styles.withBorder,diff --git a/packages/core/src/Dialog/Dialog.tsx b/packages/core/src/Dialog/Dialog.tsxindex d9a28feaa1..d69825f2a5 100644--- a/packages/core/src/Dialog/Dialog.tsx+++ b/packages/core/src/Dialog/Dialog.tsx@@ -69,6 +69,7 @@ import {spacingVars,} from '../theme/tokens.stylex';import {container} from '../Layout/container.stylex';+import {containerCornerStyles} from '../Layout/containerCorners.stylex';import type {SpacingToken} from '../Layout/container.stylex';import {paddingStyles,@@ -271,6 +272,7 @@ const styles = stylex.create({height: '100dvh',maxWidth: '100dvw',maxHeight: '100dvh',+ '--_dialog-radius': '0px',borderRadius: 0,// Nothing of the page shows around a full-screen dialog: no edge.borderWidth: 0,@@ -306,6 +308,10 @@ const styles = stylex.create({overflow: 'hidden',borderRadius: 'inherit',},+ innerCorners: {+ '--_container-corner-block-start': 'var(--_dialog-radius)',+ '--_container-corner-block-end': 'var(--_dialog-radius)',+ },// Inline wrapper mirrors the dialog's visual styles without <dialog> behaviorinlineWrapper: {padding: 0,@@ -826,6 +832,8 @@ export function Dialog({effectivePadding !== 4 &&containerPaddingBlockEndVarStyles[effectivePadding],isFullscreen && useThemeDefault && styles.fullscreenSafeArea,+ styles.innerCorners,+ containerCornerStyles.publish,)}><DialogContext value={dialogContextValue}>{children}</DialogContext></div>diff --git a/packages/core/src/Layout/__tests__/ContainerCorners.a11y.chromium.spec.ts b/packages/core/src/Layout/__tests__/ContainerCorners.a11y.chromium.spec.tsnew file mode 100644index 0000000000..18b0023f51--- /dev/null+++ b/packages/core/src/Layout/__tests__/ContainerCorners.a11y.chromium.spec.ts@@ -0,0 +1,299 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.+// @pr-a11y scope ^(packages/core/src/(Layout|Card|Dialog|BottomSheet|Section|ScrollableArea|Table|List|Item)/|apps/storybook/stories/ContainerCorners\.stories)++/**+ * @file ContainerCorners.a11y.chromium.spec.ts+ * @input Built ContainerCorners stories and real Chromium keyboard input+ * @output Evidence that a full-bleed child takes the corner of the rounded+ * container it reaches, minus the padding it keeps, and that its focus+ * ring stays whole at that corner+ * @position Real-engine proof for container corner geometry; jsdom cannot+ * resolve inherited custom properties into a used radius or paint a ring+ */++// @ts-expect-error -- pngjs ships no declarations; runtime support is pinned.+import {PNG} from 'pngjs';+import {expect, test, type Page} from '@astryxdesign/a11y-spec/playwright';+import {+ DEFAULT_STORYBOOK_DIR,+ serveStorybook,+ type StaticServer,+} from '@astryxdesign/a11y-spec/storybook';++let storybook: StaticServer;+test.beforeAll(async () => {+ storybook = await serveStorybook(+ process.env.ASTRYX_STORYBOOK_DIR ?? DEFAULT_STORYBOOK_DIR,+ );+});+test.afterAll(async () => {+ await storybook?.close();+});++// Table's scroll region: the group that wraps the table.+const TABLE_REGION = '#storybook-root [role="group"]:has(> * > table)';+const BOTTOM_SHEET_TABLE_REGION = 'dialog [role="group"]:has(> * > table)';+const LIST_ROWS = '#storybook-root [role="list"] > *';++/** Used radii in physical order: top-left, top-right, bottom-right, bottom-left. */+type Radii = readonly [string, string, string, string];++async function mount(page: Page, story: string, ready: string) {+ await page.goto(+ `${storybook.origin}/iframe.html?id=core-containercorners--${story}&viewMode=story`,+ );+ await expect(page.locator(ready).first()).toBeVisible();+}++async function radii(page: Page, selector: string, index = 0): Promise<Radii> {+ return page+ .locator(selector)+ .nth(index)+ .evaluate(el => {+ const style = getComputedStyle(el);+ return [+ style.borderTopLeftRadius,+ style.borderTopRightRadius,+ style.borderBottomRightRadius,+ style.borderBottomLeftRadius,+ ] as const;+ });+}++/**+ * The used radius of the rounded container that clips `selector`: its+ * nearest ancestor with a rounded corner and a clip.+ */+async function clippingHostRadius(page: Page, selector: string) {+ return (await clippingHost(page, selector)).radius;+}++/** The used top-start radius and top border of the clipping host. */+async function clippingHost(page: Page, selector: string) {+ return page+ .locator(selector)+ .first()+ .evaluate(el => {+ for (+ let node = el.parentElement;+ node != null;+ node = node.parentElement+ ) {+ const style = getComputedStyle(node);+ const radius = parseFloat(style.borderTopLeftRadius);+ if (radius > 0 && style.overflow !== 'visible') {+ return {radius, border: parseFloat(style.borderTopWidth)};+ }+ }+ return {radius: 0, border: 0};+ });+}++async function tabTo(page: Page, selector: string, maxTabs = 20) {+ for (let i = 0; i < maxTabs; i++) {+ await page.keyboard.press('Tab');+ const reached = await page.evaluate(+ sel => document.activeElement?.closest(sel) != null,+ selector,+ );+ if (reached) {+ return;+ }+ }+ throw new Error(`Tab never reached ${selector}`);+}++/**+ * Counts pixels in the ring's colour on the 45-degree line that runs inward+ * from one corner of `selector`'s box. A ring that follows the corner+ * crosses this line; a square ring that the container's rounded clip cuts+ * off does not.+ */+async function ringPixelsOnCornerDiagonal(+ page: Page,+ selector: string,+ ringElement: string,+ corner: 'top-left' | 'bottom-right',+): Promise<number> {+ const size = 16;+ const {box, ring} = await page.evaluate(+ ({sel, ringSel}) => {+ const target = document.querySelector(sel);+ const ringOwner = document.querySelector(ringSel);+ if (target == null || ringOwner == null) {+ throw new Error(`Missing ${sel} or ${ringSel}`);+ }+ const rect = target.getBoundingClientRect();+ return {+ box: {x: rect.x, y: rect.y, width: rect.width, height: rect.height},+ ring: getComputedStyle(ringOwner).outlineColor,+ };+ },+ {sel: selector, ringSel: ringElement},+ );+ const x = corner === 'top-left' ? box.x : box.x + box.width - size;+ const y = corner === 'top-left' ? box.y : box.y + box.height - size;+ const shot = await page.screenshot({+ clip: {x: Math.round(x), y: Math.round(y), width: size, height: size},+ scale: 'css',+ });+ const png = PNG.sync.read(shot);+ const [r, g, b] = (ring.match(/\d+(\.\d+)?/g) ?? []).map(Number);+ const distanceAt = (x: number, y: number) => {+ const offset = (y * png.width + x) * 4;+ return (+ Math.abs(png.data[offset] - r) ++ Math.abs(png.data[offset + 1] - g) ++ Math.abs(png.data[offset + 2] - b)+ );+ };+ // A 2px ring drawn on a curve is anti-aliased where it crosses the+ // diagonal, so each step also checks the pixel beside it.+ let hits = 0;+ for (let i = 0; i < size - 1; i++) {+ const p = corner === 'top-left' ? i : size - 1 - i;+ const q = corner === 'top-left' ? p + 1 : p - 1;+ if (Math.min(distanceAt(p, p), distanceAt(q, p), distanceAt(p, q)) < 120) {+ hits++;+ }+ }+ return hits;+}++test.describe('Container corners (Chromium)', () => {+ test.use({viewport: {width: 480, height: 800}});++ test('a table that fills a Card takes the card corner at all four corners', async ({+ page,+ }) => {+ await mount(page, 'table-in-card', TABLE_REGION);+ const corner = await clippingHostRadius(page, TABLE_REGION);+ expect(corner).toBeGreaterThan(0);+ expect(await radii(page, TABLE_REGION)).toEqual(+ Array(4).fill(`${corner}px`),+ );+ });++ test('the focus ring of a table that fills a Card stays whole at the corners', async ({+ page,+ }) => {+ await mount(page, 'table-in-card', TABLE_REGION);+ await tabTo(page, TABLE_REGION);+ for (const corner of ['top-left', 'bottom-right'] as const) {+ expect(+ await ringPixelsOnCornerDiagonal(+ page,+ TABLE_REGION,+ TABLE_REGION,+ corner,+ ),+ corner,+ ).toBeGreaterThan(0);+ }+ });++ test('text above the table keeps the card padding there, so only the bottom corners round', async ({+ page,+ }) => {+ await mount(page, 'table-after-text-in-card', TABLE_REGION);+ const corner = await clippingHostRadius(page, TABLE_REGION);+ expect(corner).toBeGreaterThan(0);+ expect(await radii(page, TABLE_REGION)).toEqual([+ '0px',+ '0px',+ `${corner}px`,+ `${corner}px`,+ ]);+ });++ test('a Section between the Card and the table keeps the table square', async ({+ page,+ }) => {+ await mount(page, 'table-in-section-in-card', TABLE_REGION);+ expect(await radii(page, TABLE_REGION)).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ });++ test('in a Dialog with no padding, the first and last bleeding rows take the dialog corners', async ({+ page,+ }) => {+ await mount(page, 'bleed-list-in-dialog', LIST_ROWS);+ const dialogCorner = await clippingHostRadius(page, LIST_ROWS);+ expect(dialogCorner).toBeGreaterThan(0);+ const count = await page.locator(LIST_ROWS).count();+ expect(await radii(page, LIST_ROWS, 0)).toEqual([+ `${dialogCorner}px`,+ `${dialogCorner}px`,+ '0px',+ '0px',+ ]);+ expect(await radii(page, LIST_ROWS, 1)).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ expect(await radii(page, LIST_ROWS, count - 1)).toEqual([+ '0px',+ '0px',+ `${dialogCorner}px`,+ `${dialogCorner}px`,+ ]);+ });++ test('a table between other content in a Dialog with no padding stays square', async ({+ page,+ }) => {+ await mount(page, 'table-between-text-in-dialog', TABLE_REGION);+ expect(await radii(page, TABLE_REGION)).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ });++ test('a bleeding list inside a wrapper element keeps its rows square', async ({+ page,+ }) => {+ await mount(page, 'wrapped-bleed-list-in-dialog', LIST_ROWS);+ const count = await page.locator(LIST_ROWS).count();+ for (let i = 0; i < count; i++) {+ expect(await radii(page, LIST_ROWS, i), `row ${i}`).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ }+ });++ test('in a padded Card, bleeding rows stay square', async ({page}) => {+ await mount(page, 'bleed-list-in-card', LIST_ROWS);+ const count = await page.locator(LIST_ROWS).count();+ for (let i = 0; i < count; i++) {+ expect(await radii(page, LIST_ROWS, i), `row ${i}`).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ }+ });++ test('a table at the top of a bottom sheet stays square below the grab bar', async ({+ page,+ }) => {+ await mount(page, 'table-in-bottom-sheet', BOTTOM_SHEET_TABLE_REGION);+ expect(await radii(page, BOTTOM_SHEET_TABLE_REGION)).toEqual([+ '0px',+ '0px',+ '0px',+ '0px',+ ]);+ });+});diff --git a/packages/core/src/Layout/container.stylex.ts b/packages/core/src/Layout/container.stylex.tsindex 4c0a9559cc..b2346c9702 100644--- a/packages/core/src/Layout/container.stylex.ts+++ b/packages/core/src/Layout/container.stylex.ts@@ -33,8 +33,8 @@* ```** Internal variables (`--layout-padding-inner-x`, `--container-padding-*`,- * `--_section-padding-propagated`) are implementation details and must not be- * referenced by themes. They also do not cross an overlay boundary — see+ * `--container-corner-*`, `--_section-padding-propagated`) are implementation+ * details and must not be referenced by themes. They also do not cross an overlay boundary — see* `overlayPaddingReset` in padding.stylex.ts.** SYNC: When modified, update /packages/core/src/Layout/Layout.doc.mjsdiff --git a/packages/core/src/Layout/containerCorners.stylex.ts b/packages/core/src/Layout/containerCorners.stylex.tsnew file mode 100644index 0000000000..7951aa3ed4--- /dev/null+++ b/packages/core/src/Layout/containerCorners.stylex.ts@@ -0,0 +1,53 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file containerCorners.stylex.ts+ * @input Uses @stylexjs/stylex+ * @output containerCornerStyles: the corner publication rounded padding+ * publishers share+ * @position Layout utility beside container(). Internal: the package does not+ * export this module, so the corner variables stay out of public API.+ */++import * as stylex from '@stylexjs/stylex';++/**+ * Corner publication for a rounded padding publisher (Card, Dialog). The host sets `--_container-corner-block-start` and+ * `--_container-corner-block-end` to the radius at each block edge.+ *+ * A corner goes only to the host's first or last child when that child reads+ * corners (it carries `data-container-corner`). A reader deeper inside could+ * take a corner it does not reach, so then no corner goes out.+ */+export const containerCornerStyles = stylex.create({+ publish: {+ '--container-corner-start-start': {+ default: '0px',+ ':has(> [data-container-corner]:first-child)': {+ default: 'var(--_container-corner-block-start, 0px)',+ ':has(> * [data-container-corner])': '0px',+ },+ },+ '--container-corner-start-end': {+ default: '0px',+ ':has(> [data-container-corner]:first-child)': {+ default: 'var(--_container-corner-block-start, 0px)',+ ':has(> * [data-container-corner])': '0px',+ },+ },+ '--container-corner-end-start': {+ default: '0px',+ ':has(> [data-container-corner]:last-child)': {+ default: 'var(--_container-corner-block-end, 0px)',+ ':has(> * [data-container-corner])': '0px',+ },+ },+ '--container-corner-end-end': {+ default: '0px',+ ':has(> [data-container-corner]:last-child)': {+ default: 'var(--_container-corner-block-end, 0px)',+ ':has(> * [data-container-corner])': '0px',+ },+ },+ },+});diff --git a/packages/core/src/Layout/layoutReset.test.tsx b/packages/core/src/Layout/layoutReset.test.tsxindex 9821a00daa..670f6a6acb 100644--- a/packages/core/src/Layout/layoutReset.test.tsx+++ b/packages/core/src/Layout/layoutReset.test.tsx@@ -49,6 +49,10 @@ const RESET_VALUES: Record<string, string[]> = {'--container-padding-inline-end','--container-padding-block-start','--container-padding-block-end',+ '--container-corner-start-start',+ '--container-corner-start-end',+ '--container-corner-end-start',+ '--container-corner-end-end',],initial: ['--layout-padding-outer-x',diff --git a/packages/core/src/Layout/overlayPaddingReset.stylex.ts b/packages/core/src/Layout/overlayPaddingReset.stylex.tsindex 94c7192d5c..2e1b9fc1b8 100644--- a/packages/core/src/Layout/overlayPaddingReset.stylex.ts+++ b/packages/core/src/Layout/overlayPaddingReset.stylex.ts@@ -61,6 +61,12 @@ export const overlayPaddingReset = stylex.create({'--container-padding-inline-end': '0px','--container-padding-block-start': '0px','--container-padding-block-end': '0px',+ // The corner a full-bleed descendant takes: the overlay root is not the+ // page container's corner.+ '--container-corner-start-start': '0px',+ '--container-corner-start-end': '0px',+ '--container-corner-end-start': '0px',+ '--container-corner-end-end': '0px',// Added by descendants — fall through to each reader's own default.'--layout-padding-outer-x': 'initial','--layout-padding-outer-y': 'initial',diff --git a/packages/core/src/List/List.doc.mjs b/packages/core/src/List/List.doc.mjsindex 70075ff3fc..66e53237bd 100644--- a/packages/core/src/List/List.doc.mjs+++ b/packages/core/src/List/List.doc.mjs@@ -7,7 +7,16 @@ export const docs = {displayName: 'List',group: 'List',category: 'Table & List',- keywords: ["list","listitem","listbox","menu","collection","items","ul","navlist"],+ keywords: [+ 'list',+ 'listitem',+ 'listbox',+ 'menu',+ 'collection',+ 'items',+ 'ul',+ 'navlist',+ ],theming: {targets: [{className: 'astryx-list', visualProps: ['density', 'listStyle']},@@ -41,7 +50,8 @@ export const docs = {{name: 'density',type: "'compact' | 'balanced' | 'spacious'",- description: "Spacing density for items. Under a finger, an interactive row's hit target reaches 44px where its neighbors leave room, with no change to how rows look or lay out.",+ description:+ "Spacing density for items. Under a finger, an interactive row's hit target reaches 44px where its neighbors leave room, with no change to how rows look or lay out.",default: "'balanced'",},{@@ -53,25 +63,27 @@ export const docs = {{name: 'animatedLayout',type: 'AnimatedLayout',- description: 'The handle from useAnimatedLayout({containerRef}). With it, when rows are inserted, removed or reordered, an inserted row enters, a removed row collapses in place, a row that crosses rows moving the other way rides above them with the surface color behind it, and the rows after a change and the content after the list, up to that container, glide to their new places, all on one shared motion, under every pointer. Under Reduce Motion nothing travels. A row is identified by its itemKey: a row without one changes at once. Without a handle the list changes at once.',+ description:+ 'The handle from useAnimatedLayout({containerRef}). With it, when rows are inserted, removed or reordered, an inserted row enters, a removed row collapses in place, a row that crosses rows moving the other way rides above them with the surface color behind it, and the rows after a change and the content after the list, up to that container, glide to their new places, all on one shared motion, under every pointer. Under Reduce Motion nothing travels. A row is identified by its itemKey: a row without one changes at once. Without a handle the list changes at once.',},{name: 'edge',type: "'padded' | 'flush' | 'outset' | 'bleed'",description:- "Where each row's text, dividers, and hover and selection backgrounds sit, relative to the list's edges and the container around it. 'padded' keeps text inside each row's padding, so it starts a little in from a heading above the list and backgrounds have room around it. 'flush' drops the rows' side padding: text starts on the heading's line, and dividers and backgrounds stop at the row's content, with no room beyond it on either side. It works anywhere and suits static rows. 'outset' puts text on the heading's line and reaches dividers and backgrounds a little past it into the container's padding; it suits interactive rows in a container. 'bleed' puts text on the heading's line and reaches dividers and backgrounds to the container's edges with square corners, like Table rows in a Card. A row's first content is what lines up with the heading: its marker, icon, or avatar when it has one, otherwise its label. 'outset' and 'bleed' reach into the padding of the nearest container that shares its padding: a Card, Section, Dialog, or BottomSheet, or a transparent container such as a Layout region with explicit padding or a padded ScrollableArea. Place the List directly in that container's padding: padding that Stack, Center, or your own styles add in between is not counted. Drawers and the automatic padding of LayoutContent and LayoutPanel aren't supported yet. With no such container, including in a Popover, they look like 'padded'. In a container with less padding than the rows' own, text starts a little after the heading's line. A theme's inline padding on `item` replaces the row padding of every value, including the zero padding of flush.",+ "Where each row's text, dividers, and hover and selection backgrounds sit, relative to the list's edges and the container around it. 'padded' keeps text inside each row's padding, so it starts a little in from a heading above the list and backgrounds have room around it. 'flush' drops the rows' side padding: text starts on the heading's line, and dividers and backgrounds stop at the row's content, with no room beyond it on either side. It works anywhere and suits static rows. 'outset' puts text on the heading's line and reaches dividers and backgrounds a little past it into the container's padding; it suits interactive rows in a container. 'bleed' puts text on the heading's line and reaches dividers and backgrounds to the container's edges, like Table rows in a Card. Rows are square, except that when the list is the first or last child of a rounded Card or Dialog that holds no other Table or bleeding List deeper inside, its first row (when it has no header) or last row takes the container's corner, less the container padding above or below it. A row's first content is what lines up with the heading: its marker, icon, or avatar when it has one, otherwise its label. 'outset' and 'bleed' reach into the padding of the nearest container that shares its padding: a Card, Section, Dialog, or BottomSheet, or a transparent container such as a Layout region with explicit padding or a padded ScrollableArea. Place the List directly in that container's padding: padding that Stack, Center, or your own styles add in between is not counted. Drawers and the automatic padding of LayoutContent and LayoutPanel aren't supported yet. With no such container, including in a Popover, they look like 'padded'. In a container with less padding than the rows' own, text starts a little after the heading's line. A theme's inline padding on `item` replaces the row padding of every value, including the zero padding of flush.",default: "'padded'",},{name: 'edgeCompensation',type: "'inline'",description:- "Deprecated: use edge=\"outset\", which this sets. Still works; edge wins when both are set. `astryx upgrade` rewrites existing usage.",+ 'Deprecated: use edge="outset", which this sets. Still works; edge wins when both are set. `astryx upgrade` rewrites existing usage.',},{name: 'header',type: 'ReactNode',- description: 'Header content, associated with the list via aria-labelledby.',+ description:+ 'Header content, associated with the list via aria-labelledby.',slotElements: [{__element: 'Text',@@ -85,7 +97,8 @@ export const docs = {{name: 'listStyle',type: "'none' | 'disc' | 'decimal' | 'circle'",- description: "List marker style. 'decimal' renders an <ol> element instead of <ul>.",+ description:+ "List marker style. 'decimal' renders an <ol> element instead of <ul>.",default: "'none'",},{@@ -98,29 +111,72 @@ export const docs = {{name: 'xstyle',type: 'StyleXStyles',- description: 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.',+ description:+ 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.',},],- components: [- {name: 'ListItem'},- ],+ components: [{name: 'ListItem'}],usage: {description:'A vertical collection of items with consistent spacing, dividers, and optional markers. Supports headers, icons, avatars, badges, and interactive items with click or link behavior. Use it to display ordered or unordered groups of related content.',bestPractices: [- { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },- { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },- { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },- { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },- { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },- { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },- { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },+ {+ guidance: true,+ description:+ 'Provide a header to label the list and give context to screen readers.',+ },+ {+ guidance: true,+ description:+ 'Use start and end content slots to add icons, avatars, or badges to each item.',+ },+ {+ guidance: true,+ description:+ 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.',+ },+ {+ guidance: true,+ description:+ 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".',+ },+ {+ guidance: false,+ description:+ 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.',+ },+ {+ guidance: false,+ description:+ 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.',+ },+ {+ guidance: false,+ description:+ 'Mix clickable and non-clickable items in the same list without clear visual distinction.',+ },],anatomy: [- {name: 'List title', required: true, description: 'Heading that labels the list.'},- {name: 'Description', required: false, description: 'Supplementary text below the title.'},- {name: 'List items', required: true, description: 'Individual entries, which may include icons or images.'},- {name: 'Item description', required: false, description: 'Additional detail for an individual list item.'},+ {+ name: 'List title',+ required: true,+ description: 'Heading that labels the list.',+ },+ {+ name: 'Description',+ required: false,+ description: 'Supplementary text below the title.',+ },+ {+ name: 'List items',+ required: true,+ description: 'Individual entries, which may include icons or images.',+ },+ {+ name: 'Item description',+ required: false,+ description: 'Additional detail for an individual list item.',+ },],},};@@ -130,19 +186,63 @@ export const docsZh = {description:'A vertical collection of items with consistent spacing, dividers, and optional markers. Supports headers, icons, avatars, badges, and interactive items with click or link behavior. Use it to display ordered or unordered groups of related content.',bestPractices: [- { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },- { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },- { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },- { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },- { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },- { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },- { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },+ {+ guidance: true,+ description:+ 'Provide a header to label the list and give context to screen readers.',+ },+ {+ guidance: true,+ description:+ 'Use start and end content slots to add icons, avatars, or badges to each item.',+ },+ {+ guidance: true,+ description:+ 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.',+ },+ {+ guidance: true,+ description:+ 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".',+ },+ {+ guidance: false,+ description:+ 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.',+ },+ {+ guidance: false,+ description:+ 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.',+ },+ {+ guidance: false,+ description:+ 'Mix clickable and non-clickable items in the same list without clear visual distinction.',+ },],anatomy: [- {name: 'List title', required: true, description: 'Heading that labels the list.'},- {name: 'Description', required: false, description: 'Supplementary text below the title.'},- {name: 'List items', required: true, description: 'Individual entries, which may include icons or images.'},- {name: 'Item description', required: false, description: 'Additional detail for an individual list item.'},+ {+ name: 'List title',+ required: true,+ description: 'Heading that labels the list.',+ },+ {+ name: 'Description',+ required: false,+ description: 'Supplementary text below the title.',+ },+ {+ name: 'List items',+ required: true,+ description: 'Individual entries, which may include icons or images.',+ },+ {+ name: 'Item description',+ required: false,+ description: 'Additional detail for an individual list item.',+ },],},};@@ -155,19 +255,63 @@ export const docsDense = {description:'A vertical collection of items with consistent spacing, dividers, and optional markers. Supports headers, icons, avatars, badges, and interactive items with click or link behavior. Use it to display ordered or unordered groups of related content.',bestPractices: [- { guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },- { guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },- { guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },- { guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },- { guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },- { guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },- { guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },+ {+ guidance: true,+ description:+ 'Provide a header to label the list and give context to screen readers.',+ },+ {+ guidance: true,+ description:+ 'Use start and end content slots to add icons, avatars, or badges to each item.',+ },+ {+ guidance: true,+ description:+ 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.',+ },+ {+ guidance: true,+ description:+ 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".',+ },+ {+ guidance: false,+ description:+ 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.',+ },+ {+ guidance: false,+ description:+ 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.',+ },+ {+ guidance: false,+ description:+ 'Mix clickable and non-clickable items in the same list without clear visual distinction.',+ },],anatomy: [- {name: 'List title', required: true, description: 'Heading that labels the list.'},- {name: 'Description', required: false, description: 'Supplementary text below the title.'},- {name: 'List items', required: true, description: 'Individual entries, which may include icons or images.'},- {name: 'Item description', required: false, description: 'Additional detail for an individual list item.'},+ {+ name: 'List title',+ required: true,+ description: 'Heading that labels the list.',+ },+ {+ name: 'Description',+ required: false,+ description: 'Supplementary text below the title.',+ },+ {+ name: 'List items',+ required: true,+ description: 'Individual entries, which may include icons or images.',+ },+ {+ name: 'Item description',+ required: false,+ description: 'Additional detail for an individual list item.',+ },],},};diff --git a/packages/core/src/List/List.tsx b/packages/core/src/List/List.tsxindex 68c4ffebff..7c1e6739b6 100644--- a/packages/core/src/List/List.tsx+++ b/packages/core/src/List/List.tsx@@ -91,8 +91,9 @@ export interface ListProps extends BaseProps<* reach a little past it into the container's padding. Suits interactive* rows in a container* - 'bleed': text sits on the heading's line, and dividers and backgrounds- * reach the container's edges with square corners, like Table rows in a- * Card+ * reach the container's edges, like Table rows in a Card. Rows are+ * square, except that the first or last row of a list that is a rounded+ * Card's or Dialog's first or last child takes its corner** A row's first content is what lines up with the heading: its marker,* icon, or avatar when it has one, otherwise its label. 'outset' and@@ -197,6 +198,48 @@ const styles = stylex.create({width:'calc(100% + var(--container-padding-inline-start, 0px) + var(--container-padding-inline-end, 0px))',},+ // 'bleed' rows reach the container's padding edge inline, and keep its block+ // padding. The list passes its first and last rows the corner a rounded+ // container publishes, less that block padding. It is at a corner only as+ // the container's first or last child.+ bleedCorners: {+ '--_list-corner-start-start': {+ default: '0px',+ ':first-child':+ 'max(0px, var(--container-corner-start-start, 0px) - var(--container-padding-block-start, 0px))',+ },+ '--_list-corner-start-end': {+ default: '0px',+ ':first-child':+ 'max(0px, var(--container-corner-start-end, 0px) - var(--container-padding-block-start, 0px))',+ },+ '--_list-corner-end-start': {+ default: '0px',+ ':last-child':+ 'max(0px, var(--container-corner-end-start, 0px) - var(--container-padding-block-end, 0px))',+ },+ '--_list-corner-end-end': {+ default: '0px',+ ':last-child':+ 'max(0px, var(--container-corner-end-end, 0px) - var(--container-padding-block-end, 0px))',+ },+ },+ // With a header, the list's root is the container's child, and the header+ // sits above the first row.+ bleedCornersBelowHeader: {+ '--_list-corner-start-start': '0px',+ '--_list-corner-start-end': '0px',+ '--_list-corner-end-start': {+ default: '0px',+ ':last-child':+ 'max(0px, var(--container-corner-end-start, 0px) - var(--container-padding-block-end, 0px))',+ },+ '--_list-corner-end-end': {+ default: '0px',+ ':last-child':+ 'max(0px, var(--container-corner-end-end, 0px) - var(--container-padding-block-end, 0px))',+ },+ },withDividers: {gap: 0,},@@ -311,6 +354,11 @@ export function List({// role restores "list, N items" announcements for every listStyle// variant.role="list"+ // A bleeding list reads the corner its container publishes. With a+ // header, the root below is the container's child and reads it.+ {...(edge === 'bleed' && header == null+ ? {'data-container-corner': ''}+ : null)}{...mergeProps(themeProps('list', {density, listStyle}),stylex.props(@@ -319,6 +367,7 @@ export function List({isOrdered && styles.numberColumns,hasDividers && styles.withDividers,reachesContainerPadding && styles.reachesContainerPadding,+ edge === 'bleed' && header == null && styles.bleedCorners,listStyle !== 'none' &&(start != null && start !== 1? dynamicStyles.counterStart(start - 1)@@ -351,7 +400,12 @@ export function List({return (<ListContext value={contextValue}>{snapshot}- <div {...stylex.props(styles.root)}>+ <div+ {...(edge === 'bleed' ? {'data-container-corner': ''} : null)}+ {...stylex.props(+ styles.root,+ edge === 'bleed' && styles.bleedCornersBelowHeader,+ )}><div id={headerId} {...stylex.props(styles.header)}>{header}</div>diff --git a/packages/core/src/List/ListItem.tsx b/packages/core/src/List/ListItem.tsxindex a6c5f32f18..74d15c2677 100644--- a/packages/core/src/List/ListItem.tsx+++ b/packages/core/src/List/ListItem.tsx@@ -212,14 +212,31 @@ const styles = stylex.create({},// 'bleed': the row fills the list, which reaches the container's padding// edge (List.tsx); its text sits on the container's padding line, never- // closer to the row's edge than its own inset. Square corners: the row- // meets the container's straight sides.+ // closer to the row's edge than its own inset. Square corners where the row+ // meets the container's straight sides; the first and last rows take the+ // corners the list publishes for a rounded container's corner.edgeBleed: {paddingInlineStart:'max(var(--container-padding-inline-start, 0px), var(--_item-inset-inline))',paddingInlineEnd:'max(var(--container-padding-inline-end, 0px), var(--_item-inset-inline))',borderRadius: 0,+ borderStartStartRadius: {+ default: null,+ ':first-child': 'var(--_list-corner-start-start, 0px)',+ },+ borderStartEndRadius: {+ default: null,+ ':first-child': 'var(--_list-corner-start-end, 0px)',+ },+ borderEndStartRadius: {+ default: null,+ ':last-child': 'var(--_list-corner-end-start, 0px)',+ },+ borderEndEndRadius: {+ default: null,+ ':last-child': 'var(--_list-corner-end-end, 0px)',+ },},// Under a finger, the row's touch band rises above the rows after it. A// later row is positioned with no z-index, so it would paint and hit-testdiff --git a/packages/core/src/Table/Table.tsx b/packages/core/src/Table/Table.tsxindex 8a757f05d8..2ddbbea1d8 100644--- a/packages/core/src/Table/Table.tsx+++ b/packages/core/src/Table/Table.tsx@@ -140,6 +140,25 @@ const scrollWrapperStyles = stylex.create({default: null,':last-child': 'calc(-1 * var(--container-padding-block-end, 0px))',},+ // As its container's first or last child, the region reaches that block+ // edge. There it takes the published corner, so its ring and fills follow+ // the curve. Every other corner is square.+ borderStartStartRadius: {+ default: '0px',+ ':first-child': 'var(--container-corner-start-start, 0px)',+ },+ borderStartEndRadius: {+ default: '0px',+ ':first-child': 'var(--container-corner-start-end, 0px)',+ },+ borderEndStartRadius: {+ default: '0px',+ ':last-child': 'var(--container-corner-end-start, 0px)',+ },+ borderEndEndRadius: {+ default: '0px',+ ':last-child': 'var(--container-corner-end-end, 0px)',+ },},// The wrapper bleeds to its container's edges, under a Card's border, and// the Card clips there, so its keyboard ring sits inside its own box, clear@@ -203,6 +222,8 @@ function TableScrollWrapper({'aria-labelledby':restHtmlProps['aria-label'] == null ? labelledBy : undefined,...(state.inline.isScrollable ? {tabIndex: 0} : {}),+ // Reads the corner its container publishes (scrollWrapperStyles).+ 'data-container-corner': '',...restHtmlProps,ref,...mergeProps(diff --git a/packages/core/src/theme/derivedVarRegistry.test.ts b/packages/core/src/theme/derivedVarRegistry.test.tsindex 96b2446abb..60c726cfd9 100644--- a/packages/core/src/theme/derivedVarRegistry.test.ts+++ b/packages/core/src/theme/derivedVarRegistry.test.ts@@ -309,6 +309,17 @@ const PRIVATE_SYSTEM_VARS = new Set([// `break-word` fallback. scripts/text-overflow-wrap-anywhere.test.mjs// keeps every such container setting it.'--_astryx-text-overflow-wrap',+ // List FR5 and the container-padding record's corner geometry: a bleeding+ // List passes its first and last rows the container corner they take.+ '--_list-corner-start-start',+ '--_list-corner-start-end',+ '--_list-corner-end-start',+ '--_list-corner-end-end',+ // The container-padding record's corner geometry: a rounded Card, Dialog,+ // or BottomSheet hands its block-edge radius to the shared corner+ // publication beside container().+ '--_container-corner-block-start',+ '--_container-corner-block-end',]);const CROSS_COMPONENT_VARS: Record<string, string[]> = {