Skip to content

[Component Audit] ListItem: slot docs say where content sits, and right-to-left chevrons point the right way - #11336

Merged
cixzhang merged 4 commits into
mainfrom
night-watch-component-audit/ListItem/2026-11-12
Nov 12, 2026
Merged

cixzhang merged 4 commits into
mainfrom
night-watch-component-audit/ListItem/2026-11-12

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Builders reading ListItem's docs see where its slots render: startContent sits inside the row before the label, and endContent sits inside the row after the label and description. The JSDoc said "before the item" and "after the item". The List Interactive story's chevrons now mirror in right-to-left, as the With End Controls story's chevrons already did, so the story no longer shows a right-pointing "next" chevron in a right-to-left list. No component runtime behavior changes.

Three ListItem behaviors that no test checked now have tests: the ref reaches its <li> inside and outside a List; className and style merge onto the row beside its list-item and item targets; and xstyle applies after ListItem's own styles, so a caller's value for the same property wins.

Audit result

  • Package/component: core/ListItem (released in @astryxdesign/core under ./List)
  • Mode: Night Watch whole-component audit, rubric 1.16.6
  • Base: 558725695bb, merged with main at 3406f73838e
  • Exact head: f4917f58e39627d1f2c5f61619a7c4be25398cd2
  • Component contract: existing ListItem.spec.md (authority: current), unchanged. No observational backfill was prepared.
  • Runtime change: none. JSDoc, a changeset, unit tests, three story icons, a browser evidence spec, and an axe-pass entry so the ListItem audit scans the List stories that render its rows.
Before After
Score 94.6 / A (0 open BLOCKs) 97.6 / A (0 open BLOCKs)
Distinct defects 0 BLOCK, 2 FIX, 1 NIT 0 BLOCK, 1 FIX, 0 NIT
Section W Before After State
§1 Accessibility 16 5 5 scored; each row is an <li> (AR1); the selected row carries aria-current="true"; a disabled row keeps its focusable control with aria-disabled="true" and stays in the tab order; links keep href, target, and rel with noopener noreferrer for _blank
§2 Theming 14 4.5 4.5 scored; the row carries list-item beside Item's item target (FR5); open FIX: markers are extra elements (Needs Review 1)
§3 Public API 14 4.5 5 scored; BaseProps, ref to the <li>, row props forwarded to Item (FR1). NIT closed: startContent/endContent JSDoc said "before/after the item" (P34)
§4 Behavior 12 5 5 scored; inside a List the row takes density, dividers, edge, and marker (FR2); outside it keeps Item's defaults and no marker (FR3); disc, circle, and number markers sit on the label's first line (FR4)
§5a Design, objective 6 5 5 scored; tokens for color and spacing; marker sizes are named constants
§5b Design, rendered 4 5 5 scored from receipted frames of every captured state in light and dark: rest, hover, pressed, focus-visible, selected, disabled, three markers, and links, plus right-to-left for the interactive states
§6 Testing 8 4 5 scored; FIX closed: FR1's ref and FR5's merge and xstyle order had no test (FR5's basis was "Current source")
§7 Code health 8 5 5 scored; memoized marker and handle; no Effect
§8 Docs 8 5 5 scored; every prop documented with defaults
§9 i18n and RTL 5 5 5 scored; no strings of its own; the row's start and end content follow the direction in the right-to-left frames. The story chevron fix below is a fixture fix and is not scored against ListItem
§10 Responsive and touch 5 4 4 scored; full-width row with no fixed widths; the touch target is List's (component:List FR10); no 320 px frame was captured

§11 is not run for an existing core component.

Why the score moved: the new unit cases close the §6 FIX and the JSDoc closes the §3 NIT. The §2 FIX stays open.

Pre-fix score: scored from base source before any change. Night Watch records only the landed post-fix result in the score ledger, so the pre-fix score lives here.

Findings fixed

ID Finding Authority Fix and proof
V3 (FIX) No test proved that ref reaches the <li>, that className and style merge beside the row's targets, or that xstyle applies after ListItem's own styles component:ListItem FR1, FR5, ORD2 Three new cases. Mutation checks: dropping ref from the merged refs fails the ref case; moving xstyle before ListItem's own styles fails the order case
I10 (fixture, not scored) The List Interactive story's end chevrons pointed right in right-to-left; ListItem ships no directional icon of its own Directional visuals mirror once (rtlStyles.mirror on the Icon), as the With End Controls story does xstyle={rtlStyles.mirror} on the three chevrons. Browser check: the end chevron is mirrored in right-to-left and not in left-to-right; it failed before and passes after
P34 (NIT) startContent and endContent JSDoc said "before the item" and "after the item" ListItem.tsx (Item renders both inside the row); ListItem.doc.mjs ("after the label area") JSDoc says inside the row, before the label, or after the label and description

The §6 test gap is scored FIX rather than V3's BLOCK because the behavior works and has no reachable victim; only the proof was missing.

Needs Review

  1. Markers are extra elements (open FIX). A bullet is two decorative span elements and a number is one span with a counter pseudo-element. architecture:component-style-authoring INV7 puts decoration with no role on a pseudo-element. ListItem.spec.md records this under Current-state impact. Moving the markers changes the row's structure and its shared number columns, so this pull request leaves it.
  2. target type (API, not scored). ListItemProps.target is string, but ListItem passes it to Item as '_blank' | '_self' through a type cast. Which type is right is a public API choice.
  3. swipe not built (owned elsewhere). spec:AST-057 FR1 has ListItem pass swipe through to Item, but Item has no swipe yet (DEP-0017), so ListItemProps has none either. ListItem.spec.md records this as its second Current-state gap. It is not scored against ListItem.
  4. Owned elsewhere. The selected row's fill is opaque (observed rgb(212, 212, 212) light, rgb(71, 71, 71) dark on the selected row); selection paint is component:Item's shipped selection style, so it is not scored here.
  5. Send icon in the Interactive story. The paper-airplane start icon still points right in right-to-left. Whether a send icon mirrors is a design call, so it is left as is.

Evidence

  • Audit spec: ListItemAudit.a11y.chromium.spec.ts drives the List stories that render ListItem rows (Interactive, Disabled Items, Ordered List with listStyle set to disc, circle, and decimal, and Links), in light and dark, and the interactive states in right-to-left too. Every frame has a receipt bound to the Storybook build and checkout: story id, theme, mode, direction, viewport, DPR 2, settled fonts, and no page errors. Each line below is a check that fails the receipt when it does not hold:
    • interactive (light, dark, right-to-left): the row is an <li> with the list-item and item targets and an invisible button; one selected row with aria-current="true"; the start icon at the row's inline start; the end chevron mirrored only in right-to-left; rest paints nothing; hover paints a translucent overlay (observed alpha 0.05); a press paints a stronger translucent overlay (observed alpha 0.1) without changing the row height; Tab reaches the first row, which matches :focus-visible with a solid ring of at least 2 px;
    • disabled: the row and its control carry aria-disabled="true", the control is not native disabled, the row paints nothing under the pointer, the pointer shows no interactive cursor, and Tab reaches the row;
    • markers, on rows two lines tall (label and description): every disc, circle, and number marker centers inside its label's first line and above the row's center, so a marker centered on the whole row fails; numbers come from the list counter (counter(astryx-list));
    • links: three links for three rows; the internal row keeps href="/docs"; the _blank row adds noopener noreferrer.
  • Before and after: before, the first version of the spec ran against a Storybook built at the base 5587256 from a checkout with only the spec added: 7 of 8 receipts pass, and the right-to-left interactive receipt fails with "end chevron mirrored false in rtl". After, at 4f36b9c: all 8 pass; the 14 left-to-right frames are byte-identical and the 4 right-to-left frames differ only in the mirrored chevrons. Review then moved the marker cases to two-line rows and added dark runs; at the exact head f4917f5 all 13 receipts pass (24 frames). Those cases have no before run; this pull request does not change ListItem's rendering.
  • Unit tests: 3 new List.test.tsx cases; the List folder passes (204 cases).
  • Visual acceptance: N/A for the component: its rendering is unchanged. The only rendered change is a story's icons in right-to-left.

Closed evidence inventory

Surface Source Tests Consumer docs Rendered evidence Authority Result
Exports ListItem, ListItemProps List/index.ts export checks in CI ListItem.doc.mjs — architecture:public-component-api reachable
<li> rendered through Item, row props forwarded ListItem.tsx align, swipe, data-testid, interactive cases props table interactive frames FR1, AR1 pass
ref to the <li> ListItem.tsx ref case (new) — — FR1 pass
Density, dividers, edge from the List ListItem.tsx density, divider, edge cases List.doc.mjs List audit frames FR2 pass
Outside a List ListItem.tsx inset and no-marker cases — — FR3 pass
Markers and task checkbox ListItem.tsx marker cases; ListMarkers browser spec List.doc.mjs listStyle marker frames FR4, ORD1, AR3 pass; elements open (Needs Review 1)
list-item target, className, style, xstyle order ListItem.tsx merge and order cases (new) — target in frames FR5, ORD2 pass
onClick, href, target, rel Item through ListItem.tsx button and anchor cases props table interactive and links frames FR1 pass; type in Needs Review 2
isDisabled, isSelected Item through ListItem.tsx disabled and selected cases props table disabled and selected frames AR2 (Item's) pass
itemKey ListItem.tsx reorder and layout-update suites props table List audit reorder frames spec:AST-103 DEC-4 pass
startContent, endContent, align Item through ListItem.tsx slot cases props table, JSDoc (fixed) interactive frames FR1 pass
swipeActions, swipeBehavior Item through ListItem.tsx pass-through case props table — spec:AST-057 pass
swipe not built — — — spec:AST-057 FR1, DEP-0017 gap owned elsewhere (Needs Review 3)
FR10 eligibility report
{
  "schema": "astryx.audit-eligibility/v1",
  "component": "ListItem",
  "package": "core",
  "mode": "night-watch",
  "rubricVersion": "1.16.6",
  "repository": {"base": "558725695bb", "head": "f4917f58e39627d1f2c5f61619a7c4be25398cd2"},
  "contract": {"id": "component:ListItem", "authority": "current", "changed": false},
  "inventory": {"closed": true, "rows": 13},
  "remediations": [
    {"id": "V3", "kind": "behavior-test", "evidence": "3 unit cases; ref and order mutation checks"},
    {"id": "I10-fixture", "kind": "fixture", "evidence": "story chevrons; right-to-left browser check red before, green after; not scored"},
    {"id": "P34", "kind": "doc-drift", "evidence": "startContent and endContent JSDoc"}
  ],
  "unresolved": {
    "objective": ["markers are extra elements (component-style-authoring INV7)"],
    "manual": ["ListItemProps.target type versus Item's", "send icon mirroring in a story"],
    "ownedElsewhere": ["swipe pass-through (AST-057 FR1, not built)"]
  },
  "approvals": {"specOwner": "n/a (no record change)"},
  "verdict": {"autoMergeEligible": false, "reasons": ["AST-029 FR11 activation has not shipped", "open items"]}
}

@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 12, 2026 2:12am UTC

Request Review

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

astracat-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 12, 2026, 7:47 AM UTC

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f4917f5

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
CheckboxListItem 74.4 kB (0) · 11.5 kB CSS (0) — — · — · —
ContextMenu 113.2 kB (0) · 17.5 kB CSS (0) — — · — · —
DropdownMenu 102.3 kB (0) · 17.6 kB CSS (0) — — · — · —
13 more components
Component Size LoC Visual · A11y · RTL
List 18.9 kB (0) · 790 B CSS (0) — ✓ · ✓ · —
ListItem 73.6 kB (0) · 11.5 kB CSS (0) — ✓ · ✓ · ✓
Markdown 193.4 kB (0) · 20.8 kB CSS (0) — — · — · —
MoreMenu 102.5 kB (0) · 17.6 kB CSS (0) — — · — · —
PowerSearch 299.1 kB (0) · 24.7 kB CSS (0) — — · — · —
Table 130.4 kB (0) · 18.5 kB CSS (0) — — · — · —
TableCell 114.5 kB (0) · 18.0 kB CSS (0) — — · — · —
TableHeaderCell 114.0 kB (0) · 17.7 kB CSS (0) — — · — · —
lab/Comments 358.8 kB (0) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 352.0 kB (0) · 2.4 kB CSS (0) — — · — · —
lab/TabBarMoreList 96.0 kB (0) · 1.8 kB CSS (0) — — · — · —
lab/TransferList 105.7 kB (0) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 114.5 kB (0) · 1.4 kB CSS (0) — — · — · —

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

Touched components checked; add ci:run-visual to run the full suite.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this draft head yet, so merging waits on the required checks, including the unit tests and the ListItem audit's browser spec.

The startContent and endContent JSDoc now matches where Item renders those slots. The Interactive story's chevrons mirror in right-to-left, as the With End Controls story's do. The three new tests cover ref, the className/style merge and the xstyle order. No blocking findings.

Claims and files checked
  • Changeset: the slot docs now place the content inside the row, before the label or after the label and description. Verified in ListItem.tsx and against Item's render order.
  • The old JSDoc said "before/after the item". Verified in the diff.
  • The Interactive story's three chevrons now mirror, matching the With End Controls story. Verified in List.stories.tsx.
  • No component runtime change. Verified: the ListItem.tsx change is comments only.
  • ref reaches the <li> inside and outside a List. Verified by the new test and the merged ref.
  • className and style merge beside the list-item and item targets. Verified by the new test.
  • xstyle applies after ListItem's own styles, so the caller wins. Verified by the new test and the style order.
  • These behaviors had no focused test before. Verified against the base tests.
  • The mutation checks would fail as described. Verified by reading; CI runs the tests.
  • The browser spec's before/after result, the frame counts and the 204 passing List cases are run results; CI runs the List tests and the audit spec at this head. The spec's structure (8 cases, 18 frames) matches the description.
  • The open items (markers as extra elements, the target type cast) are as described in the source and the component record.
  • The axe-pass entry makes the ListItem audit scan the List stories. Verified in the audit routing scripts.
  • Files: .changeset/list-item-audit-docs.md, .github/a11y-audit-axe.json, apps/storybook/stories/List.stories.tsx, packages/core/src/List/List.test.tsx, packages/core/src/List/ListItem.tsx, packages/core/src/List/__tests__/ListItemAudit.a11y.chromium.spec.ts: all clear.

Automated review (maintainer link)

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

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. One CI job, test-node (4/4), failed in a CLI theme-editor test (packages/cli/host/door-conformance.test.mjs) that this pull request does not touch, so merging waits for that job to pass on a rerun.

No blocking findings: the slot docs now match where Item renders startContent and endContent, the Interactive story's chevrons mirror once in right-to-left, and the three new tests cover ref, the className/style merge and the xstyle order. Optional follow-up: ListItem.spec.md still lists ref, the list-item target and the xstyle order as having no focused test, which this pull request now provides.

Claims and files checked
  • Changeset: the slot docs now place startContent and endContent inside the row, before the label or after the label and description. Verified in ListItem.tsx against Item's render order.
  • The old JSDoc said "before the item" and "after the item". Verified in the diff.
  • The Interactive story's three chevrons now mirror in right-to-left, as the With End Controls story's already did. Verified in List.stories.tsx and in CI's audit receipt at this head.
  • ListItem's runtime is unchanged. Verified: the source change is comments only, and CI's API diff for this head is empty.
  • ref reaches the <li> inside and outside a List. Verified by the new test, which passes in CI.
  • className and style merge onto the row beside its list-item and item targets. Verified by the new test, which passes in CI.
  • xstyle applies after ListItem's own styles, so the caller wins. Verified by the new test and the style order in ListItem.tsx.
  • These three behaviors had no focused test before. Verified against the base tests and the component record.
  • Dropping ref or moving xstyle first would fail the new tests. Verified by reading the tests against the code.
  • ListItem ships in Core under the List entry point, and its component record is current and unchanged. Verified.
  • The base commit, the merge with main and the exact head named in the description. Verified in the history.
  • The audit's per-section facts (an <li> row, aria-current on the selected row, a disabled row that keeps its focusable control and its tab stop, noopener noreferrer for _blank, named marker sizes, memoized marker and handle, no Effect) match the source and CI's receipts; the scores are the audit's own grading.
  • The open items left as is (markers as extra elements, the target type cast, no swipe prop yet, the selected-row fill, the unmirrored send icon) match the source, the component record and CI's receipts.
  • The browser spec drives the Interactive, Disabled Items, Ordered List (disc, circle, decimal) and Links stories in light and dark, with the interactive states in right-to-left too. Verified in the spec; all 13 receipts and 24 frames pass in CI at this head.
  • Hover and press paint translucent overlays (alpha 0.05 and 0.1) and the focused row shows a 2 px solid ring. Verified in CI's receipts.
  • The red-before, green-after runs and the byte-identical left-to-right frames are the author's runs; not reproduced here, and consistent with the spec's check and the base story.
  • The List folder's tests pass. Verified in CI: 203 UI cases across 8 files, plus a source-build test.
  • The axe-pass entry makes the ListItem audit scan the List stories that render its rows. Verified in the audit routing script and CI's report.
  • Auto-merge is not eligible because its activation has not shipped. Verified against the audit record's phase.
  • Files: .changeset/list-item-audit-docs.md, .github/a11y-audit-axe.json, apps/storybook/stories/List.stories.tsx, packages/core/src/List/List.test.tsx, packages/core/src/List/ListItem.tsx and packages/core/src/List/__tests__/ListItemAudit.a11y.chromium.spec.ts: each clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 07:13
@cixzhang
cixzhang merged commit 8677612 into main Nov 12, 2026
208 of 210 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 12, 2026
Main brings in meta#11336, which changes List/ListItem.tsx, the row that
renders the reorder handle. The merge needs no hand edit.
cixzhang pushed a commit that referenced this pull request Nov 12, 2026
…10815)

* refactor(List): write the reorder refs at commit, not in render

Conformance tidy, no visible change. The reorder session's list getter
and the mode hint's layer handle were copied into refs during render.
Each is now written in a one-line layout effect, so a render React
discards leaves nothing behind. No failure is reachable today. Every
list getter returns the same element. The layer ref's only reader is
the hint's layout effect. It reads the ref at the commit, right after
the committed render wrote it. The cleanup uses the handle it captured.

* fix(List): a reorder handle's name follows its row's place and label

A reorder handle named itself from the DOM in a passive effect: after
Item's label element when that element shows a name, else after the
row's place ("Reorder item N"). The effect ran only when the handle
rendered. A memoized row whose place changed, because a row above it
went or the rows reordered, kept the old place in its handle's name. A
label that gained or lost its text through its own state left the
handle named the old way.

The reorder session now reads both from the DOM, outside React. It
registers the list's rows and its handles' label elements with Core's
shared mutation observer, and releases them with the list. It keeps
each handle's label naming, and the place only for a handle named after
it. The handle reads them through useSyncExternalStore, as it reads
reorder mode, and renders its name from them. Only a change renders
the handle again, so its passive effect is gone. A row named after its
place still warns in development, once, from the session. positionOf
loses its last caller and goes.

The session follows the list element the List renders, which changes
when its numbering turns on or off.

ListReorderNames.test.tsx covers a row above that goes, a reorder, and
a label that gains and loses text: each fails on main and passes here.
A reorder after the numbering turns on passes on both.

* Merge main 1740654 into the reorder handle names

Main brings in #11199, whose controller reads a collection's rows
through a reader, and #11352's committed-ref hook. #11199 edits
positionOf, which this branch removes; it stays removed. One hand edit:
refreshNames reads this.rows.read(list) instead of rowsOf(list), as
#11199's positionOf did, so a collection's own reader numbers its rows.

* refactor(List): the reorder refs use the committed-ref hook

The session's list getter and the mode hint's layer handle were each
copied into a ref by a one-line layout effect. They now use Core's
useCommittedRef, which writes them in a commit-phase insertion effect.
The session's useMemo lists the stable getter ref in its dependencies.

No behavior changes. Every getter List passes reads the same list ref
when called, and the hint's effect reads the handle after either
write. A handle's cleanup can reach the getter through release(), and
gets the same list. The hint's cleanup hides the handle its setup
showed, so no cleanup reads the layer ref.

* fix(List): an unchanged handle name keeps its snapshot

The names refresh compared each handle's name with the session's own
entry, which a handle named some other way has none of before the
first read. So it stored a new {position: null, labelNamesRow: null}
and the handle rendered again with the same name on every mount
(architecture:react-component-runtime INV9). It now compares with
handleNameOf, whose shared unread name has the same fields.

A test counts the handle's renders through the verb it reads each
render: once per handle on mount, and once for a row that mounts later.

* fix(List): a hydrated handle keeps its server snapshot

The handle's server snapshot was its own unread name, and the session
answered an unread handle with another object with the same fields.
So after hydration React saw a new snapshot, and each handle rendered
again with the same name (architecture:react-component-runtime INV9).
The handle now exports one unread name, and the session answers with
it.

A test hydrates server markup and counts the handle's renders through
the verb it reads each render: once per handle.

* fix(List): a label that names its row keeps the unread snapshot

The names refresh stored whether Item's label element names the row:
null before the first read, and true after it, though the handle and
the session read both alike. So a handle named by its row's text label
rendered again with the same name after mounting and after hydrating
(architecture:react-component-runtime INV9). The snapshot now records
whether the label shows no name, which stays false until a read finds
the label blank.

Both render-count cases add a row named by its text label.

* Merge main 06b7e61 into the reorder handle names

Main brings in #10912, which changes Layer/useLayer.tsx, the layer the
mode hint shows. The merge needs no hand edit.

* Merge main 31aacff into the reorder handle names

Main brings in #11336, which changes List/ListItem.tsx, the row that
renders the reorder handle. The merge needs no hand edit.
@github-actions
github-actions Bot deleted the night-watch-component-audit/ListItem/2026-11-12 branch November 13, 2026 06:03

This branch was successfully deployed

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant