Repository navigation
fix(indicator): close the six audit blocks on the indicator layer - #4890
Conversation
The first rubric audit of the indicator layer (68.0/D, mode O, commit 505ccaa) found six blocking defects. This closes all six, plus the raw radius the same audit flagged. - P2 CheckIndicator dropped `...rest` and `xstyle` on its children branch, so a caller's data-testid, id, handlers and styling vanished whenever children were passed. - B15 CheckIndicator returned null before it looked at children, so a host passing a busy Spinner through an unchecked row rendered nothing at all -- the state a listbox row is usually in. - B12 `defaultIndicators` was typed as a TOTAL map over the OPEN `IndicatorName` union, so the documented augmentation path compiled while `getIndicator` handed back undefined. Core's own names are now a closed `CoreIndicatorName`, and the resolvers are overloaded: a core name always resolves, an augmented one is `| undefined` and the caller has to say what to do about it. - T33 The public `astryx-dropdown-menu-radio-dot` target was removed with a patch changeset and no codemod. Now a [breaking] changeset plus `rename-dropdown-menu-radio-dot-target`, staged in transforms/next. - V3 No test covered CheckIndicator at all. Adds its three cases and a registry test file that augments IndicatorMap for real. - X5a The docs told theme authors to spread `indicatorFocusRingProps()`, which exists nowhere; what shipped is useIndicatorFocusRing, and the owner paints the ring on the indicator with no cooperation. Also: the radio circle and dot use `--radius-full` instead of a raw `50%` (pixel-identical on a square box, which the size styles guarantee), and two doc clauses that contradicted the shipped design -- "rendered instead of the mark" without saying "in every state", and a DON'T against drawing nothing in a state -- now match T34.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…eckIndicator paths Self-review: the children branch spread `...rest` last, so a caller could override the indicator's own aria-hidden -- the opposite of the glyph path, which spreads first and says so in a comment. Also makes the registry test's core-name list a Record over the union, so adding a name to CoreIndicatorName without shipping a default fails to compile in the test.
Self reviewThings I'd want a reviewer to push back on, in the order I'd push back:
Fixed during self-review ( |
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsIndicator (@astryxdesign/core)
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
kentonquatman
left a comment
There was a problem hiding this comment.
This looks correct. Styling for radio buttons should driven by the theme tokens.
The busy idiom a host writes is `children={isBusy && <Spinner/>}`, which
passes `false` when it is not busy. `false` is not null and is not caught
by `??`, so every indicator took its children path, rendered nothing in
it, and dropped the checkmark, the checkbox tick and the radio dot on
every selected row.
Filed as #4893 against CheckIndicator, where #4890 moved the branch. It
was wider: measured before writing anything, ALL THREE indicators lost
their mark on `false` and on `''`. CheckIndicator additionally leaked an
empty span. #4890 widened its case from one state to every state -- the
unchecked early return had been masking it.
All three now guard with `isRenderable`, the util the repo already ships
for this. `0` still counts as content: it renders the character "0".
Also, both from the #4890 audit and contained to the same lines:
CheckIndicator's children slot now reserves the glyph's 1rem box and
carries its color, so swapping a Spinner in neither shifts the row nor
loses the disabled shade.
Adds apps/storybook/stories/Indicator.stories.tsx -- the indicators had
no story file (#4894), which is why the children path had no rendered
coverage and this shipped unseen.
Not fixed here: `ref` is dropped on the glyph path. Icon in string mode
routes through IconFromRegistry, which takes no ref, so that is a change
to Icon's ref behavior for every caller -- its own PR.
#4913) * fix(indicator): a falsy child no longer deletes the state mark The busy idiom a host writes is `children={isBusy && <Spinner/>}`, which passes `false` when it is not busy. `false` is not null and is not caught by `??`, so every indicator took its children path, rendered nothing in it, and dropped the checkmark, the checkbox tick and the radio dot on every selected row. Filed as #4893 against CheckIndicator, where #4890 moved the branch. It was wider: measured before writing anything, ALL THREE indicators lost their mark on `false` and on `''`. CheckIndicator additionally leaked an empty span. #4890 widened its case from one state to every state -- the unchecked early return had been masking it. All three now guard with `isRenderable`, the util the repo already ships for this. `0` still counts as content: it renders the character "0". Also, both from the #4890 audit and contained to the same lines: CheckIndicator's children slot now reserves the glyph's 1rem box and carries its color, so swapping a Spinner in neither shifts the row nor loses the disabled shade. Adds apps/storybook/stories/Indicator.stories.tsx -- the indicators had no story file (#4894), which is why the children path had no rendered coverage and this shipped unseen. Not fixed here: `ref` is dropped on the glyph path. Icon in string mode routes through IconFromRegistry, which takes no ref, so that is a change to Icon's ref behavior for every caller -- its own PR. * fix(storybook): key the Indicator stories to the component, not to meta CI caught what my local run could not: 'satisfies Meta' + StoryObj<typeof meta> makes `args` required on every story, and `state` is required on an indicator, so five render-only stories failed the storybook typecheck. 122 of the 123 story files use `const meta: Meta<typeof X>` with `StoryObj<typeof X>`; mine was the one that did not. Now it matches. Verified the way CI does, after a full `pnpm build`: storybook typecheck clean, storybook build completes, core typecheck (incl. tests) clean, cli typecheck:strict clean, docsite generate + 364 tests green. * fix(docsite): carry deprecatedFor and replaces in the generated registry types The docsite keeps its own copy of the authoring doc types, and `next build` type-checks the emitted componentRegistry.ts against it. Two fields had drifted out of that copy, so any full docsite build failed: deprecatedFor added to ComponentThemingTarget by #4712 (Indicator's renamed theme targets) replaces on ComponentThemingDerivedVar, used by TextArea Pre-existing on main, not introduced here -- verified by building the docsite on a clean origin/main worktree, which fails with the same `'deprecatedFor' does not exist in type 'ThemingTarget'`, and passes (315/315 static pages) with only this one-file fix applied. It surfaced on this PR because the change touches core .doc.mjs inputs, so Vercel's ignored-build-step ran a docsite build for the first time since #4712. Adds SYNC breadcrumbs on both authoring interfaces, since `check:sync` is the mechanism the repo already uses to catch exactly this drift. Diffed all six shared shapes; these two were the only gaps.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
…ets guard MoreMenu hand-assembled its `astryx-more-menu` theme target with `stableClassName()` and string concatenation. Route it through `themeProps()`/`mergeProps()` instead, so the target sits on the same reflection surface as every other one. The rendered DOM is unchanged. themingTargets.test.ts grows the second direction of the guard — documented targets must actually be rendered — and scans both `@astryxdesign/core` and `@astryxdesign/lab` package-wide for the `docs` block. `docsZh` stays a per-directory check. Rebased onto main, which moved 69 commits under it: - `themeProps()` gained a third `options.legacyNames` argument (#4712, #4890) for targets renamed behind a deprecation window. The extractor only read the first two arguments, so `astryx-checkbox`, `astryx-radio` and `astryx-radio-dot` — emitted through `legacyNames` and deliberately documented with `deprecatedFor` — looked unrendered. Teach it to read `legacyNames` string literals as rendered sites of their own, with the same prop keys (they land on the same element), and cover it with two extractor tests. - ListInput (#4740) and TransferList (#4870) landed after this branch was cut and render five undocumented targets between them. Document them, the same way the other lab components here are documented. - Stepper's targets were extended on main with the same `indicatorPosition` entry this branch added, plus `astryx-step-indicator` and the matching `docsZh` block; kept main's superset. Both sides' new MoreMenu tests are kept.
What
The first rubric audit of the indicator layer (68.0 / D, mode O, at
505ccaa327) found six blocking defects. This closes all six, plus the raw radius the same audit recorded as a FIX.The system-level design came through the audit intact — replacement by name works, families type-check, hover reaches the visual with no props, and the owner-drawn focus ring survives a replacement that forwards nothing. Every defect here is at an edge: one indicator honoured the props contract on only one of its two paths, the documented extension path returned
undefined, the docs prescribed an API that was never built, and a public theme target was deleted as a patch.CheckIndicator's children branch rendered a bare span that dropped...restandxstyle— a caller'sdata-testid,id, handlers and styling vanished whenever children were passedif (!isChecked) return nullran before the children branch, so a host passing a busySpinnerthrough an unchecked row rendered nothing — the state a listbox row is usually instateonly decides what the mark isdefaultIndicatorswas typed as a total map over the openIndicatorNameunion, so the documented augmentation path compiled whilegetIndicatorhanded backundefinedand rendering it threwCoreIndicatorName;getIndicator/useIndicatorare overloaded — a core name always resolves, an augmented one is| undefinedastryx-dropdown-menu-radio-dotwas removed with apatchchangeset and no codemod; runtime themes are not validated, so a theme keyed on it silently stops matching[breaking]changeset +rename-dropdown-menu-radio-dot-target, staged intransforms/nextCheckIndicatorat all — the default mark, and the component carrying three of the audit's defectsCheckIndicatorcases + a newindicatorRegistry.test.tsxindicatorFocusRingProps(), which exists nowhere in the repo, and described a "tells the owning control to stand down" marker that was never builtuseIndicatorFocusRing), and a replacement only needs a root element with the radius it wants the outline to followTwo other doc clauses contradicted the design we merged and now match T34:
childrenis "rendered INSTEAD of the mark" in every state, and the DON'T against "render only in the selected state" became a DON'T against assuming you are only mounted when selected — the host renders unconditionally and passesstate; drawing nothing in a state is the indicator's call.--radius-fullsquares the radio under a sharp themePer your note, the radio circle and dot now use
radiusVars['--radius-full']instead of a raw50%. On the neutral theme this is pixel-identical, as expected — the boxes are square (24/20 for the circle, 10/8 for the dot) and--radius-fullis9999px:0 of 5,670,000 pixels differ across RadioList, the menu radio, and the Selector radio replacement, in light and dark.
But y2k sets
--radius-full: 0px(it zeroes every radius —radius.multiplier: 0, brutalist by design). So the radio becomes a square there. Measured, not inferred: the corner pixel of the 24×24 box goes fromrgb(255,255,255)(outside the circle) torgb(47,41,46)(border), and the painted fraction of the box goes 16.8% → 84.0%.The consequence worth your call: under y2k the radio now has the same silhouette as the checkbox, so the mark inside (dot vs check) is the only thing telling single-choice from multi-choice apart.
Arguments both ways, briefly:
Avataralready uses--radius-fulland is already square under y2k — and it is the whole point of this workstream: the radio's shape becomes themeable instead of hard-coded. A theme that asked for zero radius everywhere gets it.50%. Shape is the affordance for single-vs-multiple selection, and a theme squaring an avatar is not the same decision as a theme squaring a radio. Reverting is two lines inRadioIndicator.tsx.I implemented the first because you asked for the token; say the word and I'll flip it.
Note also: 7 other core files still use
borderRadius: '50%'(Pagination, Calendar, AspectRatio, Table row status, ListItem, NavIcon, StatusDot). I did not sweep them —50%and--radius-fullare interchangeable only while the box is square (measured: square 24×24 → 0/7056 px differ; wide 60×24 → 23.5% differ, ellipse vs stadium), and several of those are not guaranteed square.Consumer-facing API changes
Resolving an indicator core doesn't ship. Augmenting
IndicatorMapno longer lies about resolution:No core call site changes: every one of them passes a literal core name, which hits the non-optional overload.
Removed theme target.
dropdown-menu-radio-dotis gone; menu radios draw the shared radio indicator, so the dot carriesradio-indicator-dot(and the legacyradio-dot). The row's circle keepsdropdown-menu-radio.astryx upgraderewrites the key and theastryx-dropdown-menu-radio-dotclass.The rename is not scope-preserving and cannot be — there is no menu-only dot element left to address, so
radio-indicator-dotreaches every radio dot in the app. The codemod therefore leaves a TODO at each site it rewrites rather than pretending the swap is equivalent.Judgment call: I marked this
[breaking]/minor, per T33 and the changeset gate ([breaking]must beminorwhile 0.x). You said patch was fine for the radio dot rename — and it was, because that one kept both names vialegacyNames. This target is genuinely deleted with no alias, and a theme gets no error. If you'd rather hold the release train, deleting the second changeset keeps it a patch and the codemod still ships.Test plan
Everything below was run on this branch, not assumed.
Positive controls first — each new test was run against the pre-fix code to confirm it fails.
CheckIndicatorchildren/props tests, run against505ccaa327:CheckIndicator.tsx: 2 failed (renders children INSTEAD of the mark, in both states;forwards caller props and styling on both render paths), 17 passed.tscagainst505ccaa327:indicatorRegistry.ts: fails withTS2741: Property '"brand-star"' is missing in type ... but required— the unsoundness made visible — plusTS2578: Unused '@ts-expect-error' directivewhere the old signature wrongly promised a component.dropdown-menu-radio(the surviving circle target) left untouched; idempotent.Suites
vitest— Indicator, CheckboxInput, RadioList, Selector, DropdownMenu, theme, cli codemodstsccoretscdocs (typecheck:docs)CI=true eslint --no-cacheon both touched treescheck:sync/check:changesets/check:use-client/check:package-boundaries/check:cli-structuresync:exports:checkVisual
Real Chromium via Playwright against two Storybook instances —
505ccaa327(before) and this branch (after) — 51 image pairs across 7 stories × {neutral light, neutral dark, y2k light}, atdeviceScaleFactor: 3, with full-page shots and element crops of the circle, dot and checkbox box. Each capture asserts its subject is in the DOM before shooting, so a missing story or an unopened listbox fails loudly instead of diffing two error pages.CheckboxInput / All Variations— untouched by this PR — is 0-pixel identical in all three theme/mode combinations.border-radiusrecorded for every crop:50% → 9999pxunder neutral,50% → 0pxunder y2k.Follow-up
Re-audit and the ledger row update (the rubric requires the score to move and the change to be explained) once this lands.
Related: #4712 (the indicator layer this audits), rubric T34 corrected on the wiki in
3812e91.