Skip to content

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

TypeScript

[Component Audit] Divider: keep numeric labels visible and named (#7572)

Cindy Zhangc9dfc7a81619
diff --git a/.changeset/divider-renderable-labels.md b/.changeset/divider-renderable-labels.md
new file mode 100644
index 0000000000..cd2d280f79
--- /dev/null
+++ b/.changeset/divider-renderable-labels.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] `Divider` now keeps numeric zero labels inside the labelled separator and omits boolean or empty-string labels without leaving empty label spacing.
+
+@cixzhang
diff --git a/apps/storybook/stories/Divider.stories.tsx b/apps/storybook/stories/Divider.stories.tsx
index 207132df12..1f710a894a 100644
--- a/apps/storybook/stories/Divider.stories.tsx
+++ b/apps/storybook/stories/Divider.stories.tsx
@@ -109,9 +109,7 @@ export const FullBleed: Story = {
<Card>
<VStack gap={3}>
<Text type="label">Normal divider</Text>
- <Text type="body">
- The divider respects container padding.
- </Text>
+ <Text type="body">The divider respects container padding.</Text>
<Divider />
<Text type="body">Content below the divider.</Text>
</VStack>
@@ -119,9 +117,7 @@ export const FullBleed: Story = {
<Card>
<VStack gap={3}>
<Text type="label">Full bleed divider</Text>
- <Text type="body">
- The divider extends to container edges.
- </Text>
+ <Text type="body">The divider extends to container edges.</Text>
<Divider isFullBleed />
<Text type="body">Content below the divider.</Text>
</VStack>
@@ -187,6 +183,28 @@ export const InCard: Story = {
),
};
+export const NumericLabel: Story = {
+ render: () => (
+ <Section variant="muted">
+ <div {...stylex.props(styles.storyWrapper)}>
+ <Card>
+ <VStack gap={3}>
+ <Text type="supporting">Horizontal numeric label</Text>
+ <Divider label={0} />
+ </VStack>
+ </Card>
+ <Card height={200}>
+ <HStack gap={4} xstyle={styles.fullHeight}>
+ <Text type="body">Start</Text>
+ <Divider orientation="vertical" label={0} />
+ <Text type="body">End</Text>
+ </HStack>
+ </Card>
+ </div>
+ </Section>
+ ),
+};
+
export const FullBleedVertical: Story = {
render: () => (
<Section variant="muted">
diff --git a/packages/core/src/Chat/ChatSystemMessage.spec.md b/packages/core/src/Chat/ChatSystemMessage.spec.md
index ad87b13055..f01950f752 100644
--- a/packages/core/src/Chat/ChatSystemMessage.spec.md
+++ b/packages/core/src/Chat/ChatSystemMessage.spec.md
@@ -80,7 +80,7 @@ Consumer migration instructions belong in consumer docs and release notes.
- Sender identity, avatar, bubble, transcript ordering, or scrolling.
- Divider rule paint, label placement, separator role, or separator naming, which are delegated to `component:Divider`.
- Long Divider-label overflow and forced-colors rule paint, which remain shared `component:Divider` advisories rather than ChatSystemMessage-owned defects.
-- Divider's falsey-label rendering. Empty string and empty Fragment content leave the separator without a visible label or accessible name; numeric zero renders stray `00` text with no accessible name. This is a shared `spec:AST-002/FR15` advisory routed to `component:Divider`.
+- Divider's skipped-label rendering. Empty strings and empty Fragments leave the separator without a visible label or accessible name; numeric zero renders one visible `0` and names the separator `0`. These partitions remain owned by `component:Divider`.
- The semantic or directional meaning of caller-provided content or icon artwork.
- Announcement timing or spoken output; claims at that layer require `spec:AST-009` evidence.
@@ -99,14 +99,14 @@ observable public surface without deciding the unresolved divider/icon contract.
## Behavioral and layout contract
-| ID | Candidate invariant | Basis | Draft review state |
-| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
-| FR1 | The default branch MUST render the required content in a centered, noninteractive status row, allow long content to wrap within the available inline space, and preserve optional icon geometry. | Current source, released docs, tests, and examples | Verified current behavior |
-| FR2 | For truthy content, the divider branch MUST render the content through Divider as a labelled horizontal separator inside the component's status root. Falsey content follows the shared Divider advisory recorded in AV1. | Current source, released docs, Divider implementation, tests, and examples | Verified current behavior; shared Divider advisory |
-| FR3 | The divider branch currently ignores `icon`; this draft MUST NOT convert that observation into a stable restriction, a requirement to render the icon, or a warning policy. | `architecture:public-component-api/INV3`, `architecture:public-component-api/INV5`, and `spec:AST-002/FR15` | Human API decision required; see OQ1 |
-| FR4 | Supported root DOM, data, ARIA, className, style, xstyle, and ref inputs MUST reach or compose on the root while component-owned `role="status"` and reflected `variant` remain intact. | Current source plus `architecture:public-component-api/INV5-INV8` | Verified current behavior and existing focused evidence |
-| FR5 | The component MUST use semantic color, spacing, and typography tokens and logical layout; the `variant` state remains reflected on the single `chat-system-message` target. | Current source, `architecture:theme-tokens`, and theming architecture | Verified current behavior |
-| FR6 | The component remains render-only: props determine output without Effects, state mirrors, observers, listeners, timers, or owned async resources. | Current source and `architecture:react-component-runtime/INV1-INV8` | Verified current behavior |
+| ID | Candidate invariant | Basis | Draft review state |
+| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
+| FR1 | The default branch MUST render the required content in a centered, noninteractive status row, allow long content to wrap within the available inline space, and preserve optional icon geometry. | Current source, released docs, tests, and examples | Verified current behavior |
+| FR2 | The divider branch MUST render renderable content through Divider as a labelled horizontal separator inside the component's status root. Skipped content follows Divider's delegated label contract. | Current source, released docs, Divider implementation, tests, and examples | Verified current behavior; delegated Divider partitions |
+| FR3 | The divider branch currently ignores `icon`; this draft MUST NOT convert that observation into a stable restriction, a requirement to render the icon, or a warning policy. | `architecture:public-component-api/INV3`, `architecture:public-component-api/INV5`, and `spec:AST-002/FR15` | Human API decision required; see OQ1 |
+| FR4 | Supported root DOM, data, ARIA, className, style, xstyle, and ref inputs MUST reach or compose on the root while component-owned `role="status"` and reflected `variant` remain intact. | Current source plus `architecture:public-component-api/INV5-INV8` | Verified current behavior and existing focused evidence |
+| FR5 | The component MUST use semantic color, spacing, and typography tokens and logical layout; the `variant` state remains reflected on the single `chat-system-message` target. | Current source, `architecture:theme-tokens`, and theming architecture | Verified current behavior |
+| FR6 | The component remains render-only: props determine output without Effects, state mirrors, observers, listeners, timers, or owned async resources. | Current source and `architecture:react-component-runtime/INV1-INV8` | Verified current behavior |
### Allowed variation
@@ -116,9 +116,8 @@ observable public surface without deciding the unresolved divider/icon contract.
content unchanged: empty string and empty Fragment content remain empty, while
numeric zero renders one `0`. In the divider variant, the status root and separator
remain; empty string and empty Fragment content produce no visible label or
- accessible name, while numeric zero paints stray `00` text with no accessible name.
- The divider's falsey-label behavior is a shared `spec:AST-002/FR15` advisory routed
- to `component:Divider`.
+ accessible name, while numeric zero renders one visible `0` and names the
+ separator `0`. Divider owns those label partitions.
- **AV2 - Caller styling.** Supported root styling inputs may extend the component
without replacing owned status semantics or variant reflection.
- **AV3 - Delegated Divider paint.** Divider owns its rule and label paint and may
@@ -126,15 +125,15 @@ observable public surface without deciding the unresolved divider/icon contract.
### Representative states
-| State | Required invariant | Allowed variation |
-| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
-| Default | Centered status content is present. | Content, theme, and root styling. |
-| Default with icon | Optional icon content and visible content render together. | Caller-provided artwork and content. |
-| Default long content | Content wraps without crossing either inline edge or creating page overflow. | Theme and localized content. |
-| Divider | A labelled horizontal separator presents the supplied content. | Label content, theme, and root styling. |
-| Divider with icon | Current output is measured without deciding the ignored-input contract. | No behavior change until OQ1 is resolved. |
-| Empty ReactNode | The default variant keeps `role="status"` and renders content unchanged (empty or one `0`). In the divider variant, the status root and separator remain; empty content has no label/name, while numeric zero paints stray `00` without a name. | Empty string, numeric zero, empty Fragment. |
-| Narrow/coarse pointer | The noninteractive row remains visible without horizontal page overflow. | Theme and supported content. |
+| State | Required invariant | Allowed variation |
+| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
+| Default | Centered status content is present. | Content, theme, and root styling. |
+| Default with icon | Optional icon content and visible content render together. | Caller-provided artwork and content. |
+| Default long content | Content wraps without crossing either inline edge or creating page overflow. | Theme and localized content. |
+| Divider | A labelled horizontal separator presents the supplied content. | Label content, theme, and root styling. |
+| Divider with icon | Current output is measured without deciding the ignored-input contract. | No behavior change until OQ1 is resolved. |
+| Empty ReactNode | The default variant keeps `role="status"` and renders content unchanged (empty or one `0`). In the divider variant, the status root and separator remain; empty content has no label/name, while numeric zero renders and names one `0`. | Empty string, numeric zero, empty Fragment. |
+| Narrow/coarse pointer | The noninteractive row remains visible without horizontal page overflow. | Theme and supported content. |
### Transformation and precedence order
@@ -156,10 +155,10 @@ observable public surface without deciding the unresolved divider/icon contract.
- **AR1 - Status exposure.** The root currently exposes `role="status"` for both
variants. Browser evidence may prove role exposure; spoken announcement timing is
outside this draft and requires `spec:AST-009` evidence.
-- **AR2 - Divider relationship.** For truthy content, the divider branch delegates a
+- **AR2 - Divider relationship.** Renderable content in the divider branch delegates a
horizontal `separator` whose labelled target contains the visible label; focused DOM
- tests verify the computed accessible name. Falsey content follows the shared Divider
- advisory in AV1.
+ tests verify the computed accessible name. Skipped content follows Divider's
+ delegated label contract.
- **AR3 - Caller content.** Visible content remains the self-contained message.
Caller-provided icon content does not replace that text.
- **AR4 - Noninteractive surface.** The component introduces no focus target,
@@ -180,8 +179,8 @@ icon artwork, live-region timing, or divider/icon behavior.
## Family and system relationships
- `component:Divider` owns the delegated separator structure, role, name,
- paint, long-label overflow, and falsey-label behavior. The numeric-zero `00`
- output with no accessible name is a shared `spec:AST-002/FR15` advisory.
+ paint, long-label overflow, and label partitions. Numeric zero renders as one
+ visible label and names the separator `0`; skipped content remains unlabelled.
- `architecture:public-component-api` owns released exports, BaseProps reachability,
styling composition, and the ref contract.
- `architecture:component-theming-surface` owns the target/anatomy mapping and
@@ -197,17 +196,17 @@ icon artwork, live-region timing, or divider/icon behavior.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
-| FR1, AR1, AR3 | `ChatSystemMessage.test.tsx`, scoped axe, and exact-head Chromium receipts | Default, default with icon, long content, nested live log, neutral light/dark | Missing content, status role, icon content, wrapping, or browser-visible subject fails focused or browser evidence. | `audit:ChatSystemMessage/accessibility` |
-| FR2, AR2 | `ChatSystemMessage.test.tsx`, Divider tests, scoped axe, and exact-head Chromium receipts | Truthy divider labels plus empty string, numeric zero, and empty Fragment observations | Lost separator role, truthy label association, orientation, content, or paint fails focused or browser evidence; falsey anomalies stay routed to Divider. | `audit:ChatSystemMessage/behavior` |
-| FR3 | Closed audit inventory and exact-head observation of the divider/icon partition | Divider with supplied icon | The audit must expose, not silently omit, the unresolved branch; implementation remains unchanged until owner decision. | `audit:ChatSystemMessage/public-api` |
-| FR4 | Mutation-sensitive root-passthrough tests, source inspection, type checks, and target reflection | Default and divider roots | Removing ref, className, style, xstyle, ARIA forwarding, or owned role precedence fails focused tests. | `audit:ChatSystemMessage/public-api` |
-| FR5 | `themingTargets.test.ts`, source inspection, generated build, and exact-head computed paint | Both variants and color modes | Target/state metadata drift, raw styling, physical layout, or unresolved mode paint fails checks or browser evidence. | `audit:ChatSystemMessage/theming` |
-| FR6 | Source inspection, strict lint, and component test suite | Every render | Adding hidden state or an owned external resource triggers runtime review and corresponding evidence. | `audit:ChatSystemMessage/code-health` |
-| RTL relation | Source-hashed verified-N/A record | Both variants and caller-owned icon content | Directional component-owned content, physical positioning, ordering, scroll/drag, overlay, or horizontal keyboard behavior invalidates the record. | `audit:ChatSystemMessage/i18n-rtl` |
-| Browser matrix | `ChatSystemMessage.a11y.chromium.spec.ts` exact-head 10-sensor receipts | Default, icon, wrapped long content, divider, unresolved divider/icon, nested live log, 320px/coarse pointer, light/dark, D7 pairs | Stale build, wrong story, incorrect mode, missing semantics, default overflow, failed contrast, blank crop, or page error fails closed. | `audit:ChatSystemMessage/visual` |
-| Documentation and surface | Consumer docs, published declarations, block metadata, explicit story ownership, exports, and `check:knowledge` | Props, `./Chat` subpath, four blocks, draft record | Missing or stale public docs, export, owner route, target map, or knowledge shape fails validation or review. | `audit:ChatSystemMessage/docs` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
+| FR1, AR1, AR3 | `ChatSystemMessage.test.tsx`, scoped axe, and exact-head Chromium receipts | Default, default with icon, long content, nested live log, neutral light/dark | Missing content, status role, icon content, wrapping, or browser-visible subject fails focused or browser evidence. | `audit:ChatSystemMessage/accessibility` |
+| FR2, AR2 | `ChatSystemMessage.test.tsx`, Divider tests, scoped axe, and exact-head Chromium receipts | Labelled divider content plus empty string, numeric zero, and empty Fragment observations | Lost separator role, label association, orientation, content, or paint fails focused or browser evidence; skipped partitions stay delegated to Divider. | `audit:ChatSystemMessage/behavior` |
+| FR3 | Closed audit inventory and exact-head observation of the divider/icon partition | Divider with supplied icon | The audit must expose, not silently omit, the unresolved branch; implementation remains unchanged until owner decision. | `audit:ChatSystemMessage/public-api` |
+| FR4 | Mutation-sensitive root-passthrough tests, source inspection, type checks, and target reflection | Default and divider roots | Removing ref, className, style, xstyle, ARIA forwarding, or owned role precedence fails focused tests. | `audit:ChatSystemMessage/public-api` |
+| FR5 | `themingTargets.test.ts`, source inspection, generated build, and exact-head computed paint | Both variants and color modes | Target/state metadata drift, raw styling, physical layout, or unresolved mode paint fails checks or browser evidence. | `audit:ChatSystemMessage/theming` |
+| FR6 | Source inspection, strict lint, and component test suite | Every render | Adding hidden state or an owned external resource triggers runtime review and corresponding evidence. | `audit:ChatSystemMessage/code-health` |
+| RTL relation | Source-hashed verified-N/A record | Both variants and caller-owned icon content | Directional component-owned content, physical positioning, ordering, scroll/drag, overlay, or horizontal keyboard behavior invalidates the record. | `audit:ChatSystemMessage/i18n-rtl` |
+| Browser matrix | `ChatSystemMessage.a11y.chromium.spec.ts` exact-head 10-sensor receipts | Default, icon, wrapped long content, divider, unresolved divider/icon, nested live log, 320px/coarse pointer, light/dark, D7 pairs | Stale build, wrong story, incorrect mode, missing semantics, default overflow, failed contrast, blank crop, or page error fails closed. | `audit:ChatSystemMessage/visual` |
+| Documentation and surface | Consumer docs, published declarations, block metadata, explicit story ownership, exports, and `check:knowledge` | Props, `./Chat` subpath, four blocks, draft record | Missing or stale public docs, export, owner route, target map, or knowledge shape fails validation or review. | `audit:ChatSystemMessage/docs` |
## Decision log
diff --git a/packages/core/src/Chat/ChatSystemMessage.test.tsx b/packages/core/src/Chat/ChatSystemMessage.test.tsx
index 9f1e8d2ae0..502cd7709e 100644
--- a/packages/core/src/Chat/ChatSystemMessage.test.tsx
+++ b/packages/core/src/Chat/ChatSystemMessage.test.tsx
@@ -152,7 +152,7 @@ describe('ChatSystemMessage', () => {
expect(root).toContainElement(screen.getByRole('separator'));
});
- it('records Divider numeric-zero output for the shared FR15 advisory', () => {
+ it('keeps the numeric-zero label visible and names the shared divider', () => {
render(
<ChatSystemMessage variant="divider" data-testid="divider-zero">
{0}
@@ -160,8 +160,8 @@ describe('ChatSystemMessage', () => {
);
const root = screen.getByTestId('divider-zero');
const separator = screen.getByRole('separator');
- expect(root).toHaveTextContent('00');
- expect(separator).not.toHaveAccessibleName();
- expect(separator).not.toHaveAttribute('aria-labelledby');
+ expect(root).toHaveTextContent(/^0$/);
+ expect(separator).toHaveAccessibleName('0');
+ expect(separator).toHaveAttribute('aria-labelledby');
});
});
diff --git a/packages/core/src/Divider/Divider.doc.mjs b/packages/core/src/Divider/Divider.doc.mjs
index 8e2adf5473..7fd704fa27 100644
--- a/packages/core/src/Divider/Divider.doc.mjs
+++ b/packages/core/src/Divider/Divider.doc.mjs
@@ -40,7 +40,8 @@ export const docs = {
{
name: 'label',
type: 'ReactNode',
- description: 'Optional label centered on the divider.',
+ description:
+ 'Optional label centered on the divider. Numeric zero is preserved; null, booleans, and empty strings render no label.',
},
{
name: 'variant',
@@ -92,7 +93,8 @@ export const docsZh = {
{
name: 'label',
type: 'ReactNode',
- description: '居中显示在分隔线上的可选标签。',
+ description:
+ '居中显示在分隔线上的可选标签。数字 0 会保留;null、布尔值和空字符串不渲染标签。',
},
{
name: 'variant',
@@ -143,7 +145,7 @@ export const docsDense = {
},
propDescriptions: {
orientation: 'divider orientation',
- label: 'optional centered label on divider',
+ label: 'optional centered label; preserves 0; null/boolean/"" omit it',
variant: 'visual weight of divider line',
isFullBleed: 'extend to container edges w/ negative margins',
xstyle: 'StyleX styles for layout; must be stylex.create() value',
diff --git a/packages/core/src/Divider/Divider.spec.md b/packages/core/src/Divider/Divider.spec.md
index 8a158b6a94..78fbd25a15 100644
--- a/packages/core/src/Divider/Divider.spec.md
+++ b/packages/core/src/Divider/Divider.spec.md
@@ -1,6 +1,6 @@
---
schema_version: 3
-template_version: 3
+template_version: 7
kind: component
id: component:Divider
authority: draft
@@ -9,33 +9,61 @@ superseded_by: null
approved_by: null
approved_at: null
owners: [cixzhang]
-review_triggers: [theming]
+review_triggers: [public-api, behavior, layout, theming, accessibility, testing]
verified_by:
- [packages/core/src/Divider/Divider.test.tsx, scripts/check-knowledge.mjs]
+ [
+ packages/core/src/Divider/Divider.test.tsx,
+ packages/core/src/theme/themingTargets.test.ts,
+ apps/storybook/stories/Divider.stories.tsx,
+ ]
modules: []
families: []
design_specs: []
architecture:
- [architecture:component-theming-surface, architecture:container-padding]
+ [
+ architecture:public-component-api,
+ architecture:component-theming-surface,
+ architecture:container-padding,
+ architecture:component-test-sufficiency,
+ ]
contributing: []
-system_specs: []
+system_specs: [spec:AST-020, spec:AST-029]
---
# Divider component contract
+## Contract at a glance
+
+| Area | Contract |
+| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Public contract | `orientation`, `label`, theme-extensible `variant`, `isFullBleed`, `BaseProps<HTMLDivElement>`, and a root `ref`. |
+| Behavior | The separator renders one rule without a label and two rules around a renderable label; full bleed consumes inherited logical container inset. The theme-extensible variant axis has no settled no-match line-paint fallback. |
+| End-user impact | People can perceive a named separator across horizontal, vertical, labelled, full-bleed, narrow, and RTL compositions. A custom theme variant can still lose its line paint; OQ2 records that retained gap. |
+| Builder impact | No new caller choice. Numeric zero remains a valid label; booleans and empty strings leave one continuous unnamed rule. |
+| Compatibility/readiness | Patch-compatible observational contract. Public props, defaults, target names, and built-in appearances remain unchanged; authority stays `draft` until exact-head owner approval. |
+| Review checks | Reject missing numeric labels, physical-edge bleed, dropped root inputs, or a target/axis that disagrees with the rendered separator. Keep the custom-variant paint gap unresolved until OQ2 is settled. |
+| Governing rules | `architecture:public-component-api/INV1,INV5–INV9`; `architecture:component-theming-surface/INV3–INV7,INV14`; `architecture:container-padding/INV1,INV3,INV7–INV10`; WCAG 2.2 SC 1.3.1 and 4.1.2 through `spec:AST-020/FR1`. |
+
+This table is a review projection; the body below is authoritative.
+
## Intent
-Divider presents a separator group as one rule, or as two rules around an
-optional label. This draft records current consumer anatomy and theming
-reachability without changing runtime behavior, styling, targets, or public API.
+Divider provides a programmatic and visual separator between caller-owned content
+regions. It owns orientation, line weight, optional label placement and naming,
+logical full-bleed geometry, and the aggregate `divider` theme target. The caller
+owns the meaning of the surrounding regions.
+
+Consumer syntax and examples belong in `Divider.doc.mjs`.
## Compatibility and migration
-- Released default preserved: `yes`
-- Compatibility class: additive documentation only; runtime, DOM, styling,
- targets, aliases, and public API remain unchanged
-- Controlled/uncontrolled behavior: not applicable
-- Migration decision: none
+- Released default preserved: yes — horizontal, subtle, unlabelled, and not full
+ bleed.
+- Compatibility class: patch fix. ReactNode values that React renders, including
+ numeric zero, stay inside the label wrapper; skipped scalar labels leave one
+ continuous unnamed rule.
+- Controlled/uncontrolled behavior: not applicable.
+- Migration decision: none.
Consumer migration instructions belong in consumer docs and release notes.
@@ -43,61 +71,104 @@ Consumer migration instructions belong in consumer docs and release notes.
**Owns**
-- The separator group, its current `divider` target, the painted rule segments,
- and the optional label placement.
+- One semantic separator root and its public ref, DOM, data, ARIA, class, style,
+ event, and `xstyle` composition.
+- Horizontal and vertical rule geometry.
+- Optional label placement and the separator naming relationship.
+- Built-in subtle and strong line weights.
+- The current reflected custom-variant state, including the missing deterministic
+ line-paint fallback recorded by OQ2.
+- Logical full-bleed consumption of inherited container inset.
+- The aggregate `divider` target with reflected orientation and variant axes.
**Does not own / non-goals**
-- The meaning of the content regions separated by the divider, which is owned by
- the product callsite.
-- Container inset publication or structural page regions. Divider only reads
- inherited container geometry when `isFullBleed` is enabled.
-- Whether Rule or Label should gain public targets, which is unresolved by this
- factual backfill.
+- The meaning or heading structure of surrounding content regions — owned by the
+ product callsite.
+- Container inset publication — owned by `architecture:container-padding`.
+- A separate public target for Rule or Label — unresolved under OQ1.
+- Theme-authored custom variant paint and the public part that should own it —
+ unresolved under OQ2.
## Public concepts
-No new public concept is introduced. Consumer props and usage remain documented
-in `Divider.doc.mjs`.
+| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
+| ------------ | --------------------------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------- | ------------ | ---------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------- |
+| Orientation | `horizontal`; `vertical` | Selects the separator axis, rule geometry, and `aria-orientation`. | Every divider | `horizontal` | component | stable | Closed union; rejected by types |
+| Label | renderable ReactNode; omitted/skipped scalar | Inserts one label between two rules and names the separator unless explicit ARIA naming wins. | Every orientation and variant | omitted | caller/component | stable | `null`, booleans, and empty strings render no label; numeric zero remains visible |
+| Variant | `subtle`; `strong`; theme-added visual values | Selects line paint and reflects the requested value on the target. | Every orientation and label state | `subtle` | component/theme | stable built-ins; theme-extensible axis | An unmatched custom value has no deterministic line-paint baseline; see OQ2 |
+| Full bleed | false; true | Consumes inherited logical container inset on the divider axis. | Every orientation | false | component/container protocol | stable | Missing variables resolve to zero |
+| Root surface | ref; DOM/data/ARIA; class/style/xstyle/events | Extends the semantic separator root. | Every divider | omitted | public component API | stable | Accepted inputs compose; component-owned role and orientation remain authoritative |
## Behavioral and layout contract
-| ID | Candidate invariant | Basis | Draft review state |
-| --- | -------------------------------------------------------------------------------------------------------- | ------------------------------- | --------------------------------------------------- |
-| FR1 | The current render contains one rule without a label and two rules with the optional label between them. | Current source, docs, and tests | Verified current behavior; no new behavior decided |
-| FR2 | The divider group carries the current `divider` target; Rule and Label currently carry no public target. | Current source, docs, and tests | Verified current behavior; theming intent unsettled |
+Draft requirements identify their basis so observed code is not mistaken for an
+intentional decision.
+
+| ID | Candidate invariant | Basis | Draft review state |
+| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------- |
+| FR1 | The divider MUST render one rule without a renderable label and two rules with the label between them. Numeric zero MUST remain a renderable label. | Released ReactNode API; current source/docs; `architecture:public-component-api/INV9` | verify |
+| FR2 | The root MUST expose `role="separator"` and the selected `aria-orientation`. A renderable label MUST name it through `aria-labelledby` unless an explicit caller `aria-label` or `aria-labelledby` wins. | WCAG 2.2 SC 1.3.1 and 4.1.2; current source/tests | verify |
+| FR3 | Built-in variants MUST paint subtle or strong lines. The exported map accepts theme-added values, but an unmatched value currently leaves the inner rule without line paint; the correct fallback/target ownership requires OQ2. | `architecture:component-theming-surface/INV4,INV6,INV14`; exported `DividerVariantMap` | human decision; open BLOCK |
+| FR4 | Full bleed MUST consume inherited logical inline inset for horizontal dividers and logical block inset for vertical dividers; absent inset MUST resolve to zero. | `architecture:container-padding/INV1,INV3,INV7–INV10` | verify |
+| FR5 | The root MUST carry the `divider` target and reflect orientation and requested variant. Rule and Label currently carry no public target. | `architecture:component-theming-surface/INV3–INV6`; current metadata | verify; part exposure unsettled |
+| FR6 | Accepted ref, DOM/data/ARIA, class, style, events, and `xstyle` MUST reach or compose on the separator root without replacing component-owned role or orientation. | `architecture:public-component-api/INV5–INV8` | verify |
### Allowed variation
-- Orientation, visual weight, full-bleed layout, and label content may vary
- without changing the three-part anatomy recorded here.
+- **AV1 — Label content.** Any caller-owned ReactNode that React renders may fill
+ the label wrapper.
+- **AV2 — Theme paint.** An active theme may restyle the aggregate target and its
+ variant axis. OQ2 owns the unresolved inner-rule paint and fallback boundary.
+- **AV3 — Container geometry.** Full bleed follows the inherited per-edge inset,
+ including asymmetric and zero values.
### Representative states
-- Unlabelled horizontal and vertical dividers render one Rule.
-- Labelled horizontal and vertical dividers render Label between two instances
- of Rule.
+| State | Required invariant | Allowed variation |
+| ----------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------ |
+| Unlabelled horizontal | One subtle or strong inline rule; horizontal separator semantics | Container width and theme paint |
+| Labelled horizontal | Two rules around one visible, naming label | Any renderable label content |
+| Numeric zero label | One visible `0` inside the label wrapper; separator name `0` | Any orientation or variant |
+| Vertical labelled/unlabelled | Block-axis rules and vertical separator semantics | Container height and label content |
+| Theme-added variant without a match | Requested variant reflected; inner rule has no component-owned paint (open BLOCK) | Custom variant name |
+| Full bleed | Logical-axis inset consumed without physical-direction assumptions | Uniform, asymmetric, zero, or absent inset |
+| RTL | Horizontal geometry remains logical; full bleed consumes inline start/end independently | Surrounding content and label language |
### Transformation and precedence order
-- No new layout or styling precedence rule is introduced.
+- **ORD1 — Label presence.** Apply the shared renderable-value predicate; when a
+ label remains, render and reference one wrapper between two rules.
+- **ORD2 — Accessible name.** Explicit `aria-labelledby` wins, then explicit
+ `aria-label`, then the rendered label wrapper; an unlabelled separator stays
+ unnamed.
+- **ORD3 — Variant paint.** Reflect the requested value on the root target. Built-in
+ values select subtle or strong inner-rule paint; unmatched custom values select no
+ inner-rule paint pending OQ2.
### Performance and resources
-- No new performance or resource rule is introduced.
+- **PR1 — No external lifecycle.** Divider installs no listener, observer, timer,
+ request, state machine, or Effect.
## Accessibility contract
-This draft does not change or extend Divider's existing separator naming or
-orientation behavior.
+- **AR1 — Programmatic separator.** The root exposes separator role and the exact
+ visual orientation.
+- **AR2 — Label relationship.** A rendered label names the separator unless the
+ caller supplies an explicit accessible name relationship.
+- **AR3 — Decorative rule segments.** Internal rule elements add no separate role,
+ name, focus target, or interaction.
## Design relationships
-| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
-| ---------------- | ----------------------------------------------------------------- | ------------------------------ | -------------- | ------------------ |
-| Divider group | Arranges the separator's rule segments and optional label. | Current source and public docs | Supporting | FR1, FR2 |
-| Rule | Paints the separator line in the selected orientation and weight. | Current source and public docs | Supporting | FR1, FR2 |
-| Label | Presents optional content between two rule segments. | Current source and public docs | Prominent | FR1, FR2 |
+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
+| ---------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | -------------- | ------------------ |
+| Divider group | Arrange rule segments and the optional label on one logical axis. | observed; container geometry settled by current architecture | supporting | FR1, FR4 |
+| Rule | Paint a visible subtle or strong separation line; theme-added values lack a settled fallback. | built-ins observed; custom fallback unsettled | supporting | FR3 |
+| Label | Present optional content between two rules using supporting text tokens. | observed; separate target exposure unsettled | prominent | FR1–FR2 |
+
+No component-local visual decision is settled by this draft.
### Theming anatomy
@@ -125,20 +196,27 @@ public targets.
## Family and system relationships
-`family:layout-regions` does not own Divider: separating content is not a
-structural page-region contract. `architecture:container-padding` owns the
-inherited inset geometry that Divider reads only when `isFullBleed` is enabled.
-`architecture:component-theming-surface` owns anatomy qualification, target
-mapping, and the difference between factual reachability and intended public
-theming API.
+- `architecture:container-padding` owns the inherited internal inset protocol;
+ Divider consumes it only through `isFullBleed`.
+- `architecture:component-theming-surface` owns the aggregate target, reflected
+ axes, anatomy qualification, and the requirement that an open visual axis have
+ a deterministic fallback. Divider's current custom-value path does not satisfy
+ that requirement; OQ2 keeps remediation out of this objective audit patch.
+- `architecture:public-component-api` owns root composition, ref behavior, and
+ compatibility of the released ReactNode label surface.
+- There is no current Divider family or design record.
+- `spec:AST-029` keeps this observational draft separate from the audit receipt.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ------------------- | ------------------------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------- | ----------------------- |
-| FR1 | `Divider.test.tsx` structure and label suites | Labelled and unlabelled; both axes | Removing or reordering Rule or Label instances fails existing child-count and content assertions. | `audit:Divider/anatomy` |
-| FR2 | Source inspection and current target inventories | Group, Rule, and Label | Adding or documenting a current target without updating the anatomy map fails repository checks. | `audit:Divider/theming` |
-| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and current target | Missing, extra, prefixed, stale, or alias-backed mappings fail repository validation. | `audit:Divider/theming` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ---------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------- |
+| FR1–FR2, AR1–AR3 | `Divider.test.tsx`; component-owned Storybook states; scoped axe | labelled/unlabelled, numeric zero, explicit names, both orientations | Truthiness renders zero outside wrappers or leaves the separator unnamed; role/orientation/name drift fails | `audit:Divider/§1,§4` |
+| FR3 | Source review; global extensible-axis structural guard | subtle, strong, unmatched theme-added value | The current unmatched path leaves the rule unpainted; no Divider-specific browser fallback proof exists | `audit:Divider/§2` |
+| FR4 | Source review; horizontal and vertical full-bleed stories | inline/block, LTR/RTL logical properties, absent inset | A physical property or wrong axis consumes unrelated container geometry | `audit:Divider/§5,§9,§10` |
+| FR5 | `themingTargets.test.ts`; component metadata; spec anatomy map | both orientations and variants | Target/axis/anatomy metadata disagrees with runtime reflection | `audit:Divider/§2` |
+| FR6 | `Divider.test.tsx`; lint, typecheck, and source review | ref, DOM/data/ARIA, class/style/xstyle/events | An accepted input is dropped or component-owned semantics are overwritten | `audit:Divider/§3` |
+| PR1 | Source review | every state | A lifecycle mechanism appears without a resource contract | `audit:Divider/§7` |
## Decision log
@@ -150,8 +228,16 @@ or theming decision.
- **OQ1 — Should Rule or Label gain stable public theming targets?** (`human-api`)
Their target exposure is unsettled; the current lack of reachability does not
decide the answer.
+- **OQ2 — Should the open `variant` axis close, or which painting part owns its
+ deterministic custom-value fallback?** (`human-api`) The root target can carry
+ theme paint while the inner rule carries built-in paint. Applying a subtle inner
+ fallback can cover an existing root background; keeping the current path can make
+ the rule disappear. Current authority requires a safe fallback but does not choose
+ between closing the axis, moving target ownership, or routing paint through a
+ reviewed public property.
## Content boundary
-This file does not duplicate consumer prop tables/examples, current audit
-results, implementation steps, or system rules. It links to their owners.
+This file does not duplicate consumer prop tables/examples, current audit scores,
+screenshot matrices, implementation steps, or system rules. The audit pull request
+owns the closed run evidence required by `spec:AST-029/FR5`.
diff --git a/packages/core/src/Divider/Divider.test.tsx b/packages/core/src/Divider/Divider.test.tsx
index 7c47adeb1a..f739c07317 100644
--- a/packages/core/src/Divider/Divider.test.tsx
+++ b/packages/core/src/Divider/Divider.test.tsx
@@ -128,6 +128,21 @@ describe('Divider', () => {
expect(divider).not.toHaveAttribute('aria-labelledby');
});
+ it.each([false, true, ''])('omits a label wrapper for %j', label => {
+ render(<Divider label={label} data-testid="divider" />);
+ const divider = screen.getByTestId('divider');
+ expect(divider).not.toHaveAttribute('aria-labelledby');
+ expect(divider.children).toHaveLength(1);
+ });
+
+ it('preserves a numeric zero label and uses it as the accessible name', () => {
+ render(<Divider label={0} data-testid="divider" />);
+ const divider = screen.getByTestId('divider');
+ expect(screen.getByText('0')).toBeInTheDocument();
+ expect(divider).toHaveAccessibleName('0');
+ expect(divider.children).toHaveLength(3);
+ });
+
it('renders astryx-* class names for theme targeting', () => {
render(
<Divider variant="strong" orientation="vertical" data-testid="divider" />,
diff --git a/packages/core/src/Divider/Divider.tsx b/packages/core/src/Divider/Divider.tsx
index 4b332ca388..f08a29f365 100644
--- a/packages/core/src/Divider/Divider.tsx
+++ b/packages/core/src/Divider/Divider.tsx
@@ -25,7 +25,7 @@ import {
typeScaleVars,
borderVars,
} from '../theme/tokens.stylex';
-import {mergeProps} from '../utils';
+import {isRenderable, mergeProps} from '../utils';
import {themeProps} from '../utils/themeProps';
import type {DividerVariantMap} from './index';
@@ -45,6 +45,7 @@ export interface DividerProps extends BaseProps<HTMLDivElement> {
/**
* Optional label to display centered on the divider.
+ * Numeric zero is preserved; null, booleans, and empty strings render no label.
* Rendered with small, secondary text styling.
*/
label?: ReactNode;
@@ -153,6 +154,7 @@ export function Divider({
...props
}: DividerProps) {
const isHorizontal = orientation === 'horizontal';
+ const hasLabel = isRenderable(label);
const labelId = useId();
// A separator does not derive its accessible name from its content, so the
@@ -160,7 +162,7 @@ export function Divider({
// exposed as the separator's name (WCAG 1.3.1). An explicit aria-label or
// aria-labelledby from the consumer takes precedence.
const resolvedLabelledBy =
- ariaLabelledBy ?? (label && ariaLabel == null ? labelId : undefined);
+ ariaLabelledBy ?? (hasLabel && ariaLabel == null ? labelId : undefined);
return (
<div
@@ -189,7 +191,7 @@ export function Divider({
lineStyles[variant],
)}
/>
- {label && (
+ {hasLabel && (
<div
id={labelId}
{...stylex.props(
@@ -199,7 +201,7 @@ export function Divider({
{label}
</div>
)}
- {label && (
+ {hasLabel && (
<div
{...stylex.props(
isHorizontal ? lineStyles.horizontalLine : lineStyles.verticalLine,