An open source design system that's fully customizable and agent ready
TypeScript
docs(Item): name the row states the item theme target reflects (#10104)
Cindy Zhange7c0eb593637
diff --git a/docs/specs/components/Item/Item.spec.md b/docs/specs/components/Item/Item.spec.mdindex 29a43e2bae..dccccfabc8 100644--- a/docs/specs/components/Item/Item.spec.md+++ b/docs/specs/components/Item/Item.spec.md@@ -83,6 +83,7 @@ Consumer migration instructions belong in consumer docs and release notes.- The `align` axis: its values, default, and the geometry of each value forthe start and end content slots.- Reflecting the resolved alignment on the `item` theme target.+- Reflecting highlighted, selected, and disabled state on the `item` theme target.- The forwarding rule for rows that compose Item and expose `align`.**Does not own / non-goals**@@ -103,17 +104,18 @@ Consumer migration instructions belong in consumer docs and release notes.## Behavioral and layout contract-| ID | Invariant | Basis | Draft review state |-| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ------------------ |-| FR1 | Item MUST accept `align` with exactly `center`, `start`, and `first-line`, and MUST resolve an omitted value to `center`. The geometry of `center` and `start` MUST NOT change. | `component:Item/DEC-1` | settled |-| FR2 | Under `first-line`, the block-axis center of each rendered start-content and end-content slot MUST coincide with the block-axis center of the label's first line box, for every slot block size. | Owner direction | settled |-| FR3 | Under `first-line`, a slot taller than the label's first line MUST stay inside the row's content box: the label and description move down by the difference, and the row grows to fit. No slot is clipped or painted into the row's block padding. | Owner direction | settled |-| FR4 | A row whose label renders a single line and which has no description MUST render identically under `first-line` and `center`, for every slot block size. | Follows from FR2 and FR3 | settled |-| FR5 | The first line box is the label line as Item styles it, from the active theme's body text size and leading. A theme that changes those tokens moves the alignment with them. Caller content inside `label` that sets its own font size or line height is outside the FR2 guarantee. | Shared typography source | settled |-| FR6 | `first-line` MUST hold in every density, in `stacked` and `inline` layouts, with `labelLines` truncation, and in plain, button, link, link-root, delegated, and parent-role rows. In right-to-left text it MUST produce the same block-axis placement with the slots mirrored by logical order and no DOM reordering. | `architecture:internationalization` | settled |-| FR7 | The `item` theme target MUST reflect the resolved alignment as its existing `align` selector axis, including `first-line`, and Item's public theming metadata MUST list that value. No new target, state, or theme-level default is added. | `architecture:component-theming-surface/INV6`; `component:Item/DEC-2` | settled |-| FR8 | ListItem, RadioListItem, and CheckboxListItem MUST expose `align` with Item's values and default and forward it unchanged to the Item row they render. A composing row MUST NOT drop, remap, or narrow the value. | Owner direction | settled |-| FR9 | An interactive row (an `onClick` row, an `href` row, or a delegated row with `interactiveRef`) shows its touch pressed paint only for a press that would activate it: a finger press on the row's surface or on its own action (its invisible button or link, or the control it delegates to) paints the row, and a finger press that starts on another interactive element inside the row paints none. In a row with a parent-supplied `role`, or a row whose root is a link, a press on a nested control activates the row, so it paints. A mouse press keeps the row's `:active` paint. | Owner direction, 2026-11-03: no pressed state on a container for a press that does not activate it | settled |+| ID | Invariant | Basis | Draft review state |+| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- | --------------------------- |+| FR1 | Item MUST accept `align` with exactly `center`, `start`, and `first-line`, and MUST resolve an omitted value to `center`. The geometry of `center` and `start` MUST NOT change. | `component:Item/DEC-1` | settled |+| FR2 | Under `first-line`, the block-axis center of each rendered start-content and end-content slot MUST coincide with the block-axis center of the label's first line box, for every slot block size. | Owner direction | settled |+| FR3 | Under `first-line`, a slot taller than the label's first line MUST stay inside the row's content box: the label and description move down by the difference, and the row grows to fit. No slot is clipped or painted into the row's block padding. | Owner direction | settled |+| FR4 | A row whose label renders a single line and which has no description MUST render identically under `first-line` and `center`, for every slot block size. | Follows from FR2 and FR3 | settled |+| FR5 | The first line box is the label line as Item styles it, from the active theme's body text size and leading. A theme that changes those tokens moves the alignment with them. Caller content inside `label` that sets its own font size or line height is outside the FR2 guarantee. | Shared typography source | settled |+| FR6 | `first-line` MUST hold in every density, in `stacked` and `inline` layouts, with `labelLines` truncation, and in plain, button, link, link-root, delegated, and parent-role rows. In right-to-left text it MUST produce the same block-axis placement with the slots mirrored by logical order and no DOM reordering. | `architecture:internationalization` | settled |+| FR7 | The `item` theme target MUST reflect the resolved alignment as its existing `align` selector axis, including `first-line`, and Item's public theming metadata MUST list that value. The alignment axis adds no new target or theme-level default. | `architecture:component-theming-surface/INV6`; `component:Item/DEC-2` | settled |+| FR8 | ListItem, RadioListItem, and CheckboxListItem MUST expose `align` with Item's values and default and forward it unchanged to the Item row they render. A composing row MUST NOT drop, remap, or narrow the value. | Owner direction | settled |+| FR9 | An interactive row (an `onClick` row, an `href` row, or a delegated row with `interactiveRef`) shows its touch pressed paint only for a press that would activate it: a finger press on the row's surface or on its own action (its invisible button or link, or the control it delegates to) paints the row, and a finger press that starts on another interactive element inside the row paints none. In a row with a parent-supplied `role`, or a row whose root is a link, a press on a nested control activates the row, so it paints. A mouse press keeps the row's `:active` paint. | Owner direction, 2026-11-03: no pressed state on a container for a press that does not activate it | settled |+| FR10 | The `item` theme target MUST reflect a highlighted, selected, or disabled row as `data-highlighted`, `data-selected`, and `data-disabled`, each present only while its state holds, with the names CommandPaletteItem uses. A row that composes Item reflects the states it passes to Item. | `architecture:component-theming-surface/INV6`; shipped source and focused tests, not owner-reviewed | settled; not owner-reviewed |### Allowed variation@@ -182,14 +184,15 @@ Consumer migration instructions belong in consumer docs and release notes.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------- |-| FR1, FR7 | `Item.test.tsx` alignment and theme-reflection suites; public type test | Omitted, `center`, `start`, `first-line` | A changed default, a missing `data-align="first-line"`, or a widened type fails. | `audit:Item/api` |-| FR2–FR6 | Real-Chromium geometry assertions over the Item alignment stories | Wrapped label with dot and age; avatar; densities; RTL; theme | A slot center off the first line center by more than 0.5px, or a clipped slot, fails. | `audit:Item/layout` |-| FR8 | `List.test.tsx`, `RadioList.test.tsx`, `CheckboxList.test.tsx` forwarding cases | Each composing row with `align="first-line"` | A row whose Item root lacks `data-align="first-line"` fails. | `audit:Item/api` |-| FR9 | `nestedTouchPress.adopters.test.tsx`; `Item.nestedPress.test.tsx` | A finger on the delegated control; a finger on another control in the row | A row painted for a press on another control, or not painted for a press on its delegated control, fails. | `audit:Item/behavior` |-| AR1, AR2 | Accessibility-tree snapshot of a `first-line` row against a `center` row | Plain and option rows | Any difference in name, role, description, or order fails. | `audit:Item/a11y` |-| PR1 | Source review of Item's alignment styles | All values | A ref, observer, or Effect added for alignment fails review. | `audit:Item/layout` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| -------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------- |+| FR1, FR7 | `Item.test.tsx` alignment and theme-reflection suites; public type test | Omitted, `center`, `start`, `first-line` | A changed default, a missing `data-align="first-line"`, or a widened type fails. | `audit:Item/api` |+| FR2–FR6 | Real-Chromium geometry assertions over the Item alignment stories | Wrapped label with dot and age; avatar; densities; RTL; theme | A slot center off the first line center by more than 0.5px, or a clipped slot, fails. | `audit:Item/layout` |+| FR8 | `List.test.tsx`, `RadioList.test.tsx`, `CheckboxList.test.tsx` forwarding cases | Each composing row with `align="first-line"` | A row whose Item root lacks `data-align="first-line"` fails. | `audit:Item/api` |+| FR9 | `nestedTouchPress.adopters.test.tsx`; `Item.nestedPress.test.tsx` | A finger on the delegated control; a finger on another control in the row | A row painted for a press on another control, or not painted for a press on its delegated control, fails. | `audit:Item/behavior` |+| FR10 | `Item.test.tsx` "reflects highlighted, selected, and disabled on the item theme target" | Plain, highlighted only, selected only, disabled only, and all three together | A missing attribute, or an attribute left on a row whose state does not hold, fails. | `audit:Item/theming` |+| AR1, AR2 | Accessibility-tree snapshot of a `first-line` row against a `center` row | Plain and option rows | Any difference in name, role, description, or order fails. | `audit:Item/a11y` |+| PR1 | Source review of Item's alignment styles | All values | A ref, observer, or Effect added for alignment fails review. | `audit:Item/layout` |## Decision logdiff --git a/packages/core/src/Item/Item.test.tsx b/packages/core/src/Item/Item.test.tsxindex 2e9c9fda3b..a36e05f5de 100644--- a/packages/core/src/Item/Item.test.tsx+++ b/packages/core/src/Item/Item.test.tsx@@ -955,6 +955,18 @@ describe('Item', () => {expect(item()).toHaveAttribute('data-selected', 'selected');expect(item()).not.toHaveAttribute('data-highlighted');expect(item()).not.toHaveAttribute('data-disabled');+ rerender(+ <Item label="Item" role="option" isHighlighted data-testid="item" />,+ );+ expect(item()).toHaveAttribute('data-highlighted', 'highlighted');+ expect(item()).not.toHaveAttribute('data-selected');+ expect(item()).not.toHaveAttribute('data-disabled');+ rerender(+ <Item label="Item" isDisabled onClick={() => {}} data-testid="item" />,+ );+ expect(item()).toHaveAttribute('data-disabled', 'disabled');+ expect(item()).not.toHaveAttribute('data-highlighted');+ expect(item()).not.toHaveAttribute('data-selected');});it('aligns the row on first baselines only under first-line', () => {