Skip to content

fix(breadcrumbs): audit pass, hit target, theme targets, focus ring, RTL separator guidance - #5332

Merged
cixzhang merged 3 commits into
mainfrom
night-watch-component-audit/Breadcrumbs/2026-08-22
Aug 22, 2026
Merged

cixzhang merged 3 commits into
mainfrom
night-watch-component-audit/Breadcrumbs/2026-08-22

Conversation

@cixzhang

@cixzhang cixzhang commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

First audit of core/Breadcrumbs against Component Audit Rubric v1.7.

Before: 68.6 / D, 4 open BLOCKs. After: 78.2 / C, 1 open BLOCK.

Corrected after review

A review pass over this PR found that one of its fixes was a regression and that three other claims in it were wrong. All four are corrected here, and the score is re-derived rather than patched, which moves it down from the 83.5 first posted to 78.2. The corrections are listed before the fixes because two of them undo work this PR previously claimed.

1. The RTL separator fix was a double flip, and half of it is reverted. › (U+203A) has Unicode Bidi_Mirrored=Yes, so Chromium mirrors it under RTL on its own. Adding rtlStyles.mirror flipped it a second time, which pointed the recommended separator against the reading direction. Measured from the raster at 4x rather than from a transform string: a bare › rendered in dir="rtl" is pixel-identical (0 differing pixels) to ‹ rendered in LTR, and the same glyph under scaleX(-1) matches › in LTR, which is the wrong way round. The mirror is removed from the chevron in both the story and the shipped block template. It stays where the glyph is not auto-mirrored: → (U+2192) is Bidi_Mirrored=No and measures pixel-identical in RTL and LTR unmirrored, so the arrow in the template keeps it, and an Icon separator is an SVG that the bidi algorithm never touches, so the Mirrored Icon Separator story keeps it and measures matrix(-1, 0, 0, 1, 0, 0) under RTL against none in LTR. The bestPractices rule this PR added taught the wrong thing and now states the actual one. Both call sites carry a short comment naming the property, because the next reader will be tempted to "fix" it again.

2. The screenshot harness never switched theme, so every dark capture was a light render. It drove the theme with a global named theme, which the Storybook preview does not declare; the preview declares astryxTheme, colorMode and direction. A global that does not exist is ignored silently, so all 20 __dark.png files on the evidence branch were byte-identical to their __light.png twins and the two dark tables in the previous body were light renders relabelled. The harness now uses the declared names and asserts on the rendered DOM before every capture that the theme and the direction actually applied; the dark surface measures rgb(38, 38, 38) against rgb(255, 255, 255) light, every light/dark pair differs, and the per-capture state is published beside the images as RENDER-STATE.json. The whole set was recaptured against a Storybook built from main for the before pass and from this branch for the after pass. The corrected comparison is below and it supersedes the "25 of 30 pairs at 0.00%" that was posted here.

3. pngjs is out of the repo's dependencies. It was imported only by the audit harness, which is not repo code, and it had no business in the root package.json or pnpm-lock.yaml. Both are back to their state on main, and the harness runs from a directory outside the repo, the way the earlier audits ran theirs.

4. The B8 change is backed out, because it was the wrong fix for a known accessibility bug. Making the supporting variant's current crumb --color-text-primary distinguishes the current item by colour alone. That is precisely #4421, an open WCAG 2.1 SC 1.4.1 use-of-colour failure against this component, and #4605 by @gonzoblasco has been open since 31 July fixing it properly with a non-colour indicator (semibold weight on the shared current style, which covers both variants) on the same style object. The finding is real: measured after the revert, a supporting-variant current crumb is rgb(82, 82, 82) at 12px weight 400 and so is a link beside it. This audit deliberately does not touch it. #4605 is the fix, and landing a colour-only change on those lines would either conflict with three weeks of a contributor's waiting or quietly moot it. The variant prop doc says supporting is "smaller with secondary text styling"; that is true again once the change is out (12px against 14px, secondary throughout), so it is left alone.

5. A20 and A21 are recorded as N/A for this component, not as coverage. The audit added a story rendering a disabled DropdownMenuItem so the two new sweeps had something to measure, then recorded the result as Breadcrumbs coverage. It is not: it measures DropdownMenuItem, whose passing behaviour landed yesterday in #5323. BreadcrumbItem has no disabled state of its own. The story is kept, because a disabled menu item is a real documented state worth a story, and the scorecard now records both checks as N/A.

Section W Before After
§1 Accessibility 16 3.0 4.0
§2 Theming 14 3.0 4.0
§3 Public API 14 3.0 3.0
§4 Behavior 12 3.5 4.0
§5a Design objective 6 4.0 4.5
§5b Design rendered 4 3.5 3.5
§6 Testing 8 4.0 4.0
§7 Code health 8 4.5 4.5
§8 Docs 8 3.5 4.0
§9 i18n and RTL 5 3.0 3.5
§10 Responsive and touch 5 4.0 4.5
Total 100 68.6 (D) 78.2 (C)

§9 keeps half of the I10 credit, since half the change was a regression. §5b is not scored above the pre-fix 3.5, because its evidence only became true after review caught it. §1 loses the A20/A21 attribution and §4 loses the B8 credit. The remaining BLOCK still caps the grade at C, but the cap is no longer what holds it there: the arithmetic is a C on its own, where the first pass would have been a B without the cap.

Pre-fix ledger row: 596920b4ea, recorded before any code changed, and left as it was measured. The post-fix score is not recorded yet: it is held on the M5 and goes in once this lands, so the ledger never claims a fix that is not on main.

Fixed

Every one of these was measured in real Chromium against a locally built Storybook, with @astryxdesign/core rebuilt between the two passes.

A10 (BLOCK): a 20px interactive target, 8px out of line with its neighbours

BreadcrumbItem.tsx:171 buttonReset applied a blanket padding: 0 after itemStyles.link set paddingBlock, so the block padding was wiped along with the inline padding it was there to reset. Both button paths were affected: the menu trigger and the onClick-only crumb.

before after
button height 20px 28px
sibling link height 28px 28px
button top vs link top 20 vs 16 16 vs 16

Under the 24px WCAG 2.5.8 floor, and visibly misaligned inside a single trail. Now paddingInline: 0 only, so link keeps its block padding.

T12 (BLOCK): a documented theme target that rendered on nothing

astryx-breadcrumb-item-menu-trigger is listed in theming.targets[] and never reached the DOM. A sibling stylex.props() spread replaced the className that themeProps() had built, so a theme rule written for that target matched no element.

before  allAstryxClasses: [astryx-breadcrumbs, astryx-breadcrumb-item, astryx-icon,
                           astryx-popover-surface, astryx-breadcrumb-menu, ...]
after   allAstryxClasses: [astryx-breadcrumbs, astryx-breadcrumb-item,
                           astryx-breadcrumb-item-menu-trigger, ...]

Merged through mergeProps, which is what T12 asks for. Two notes worth carrying forward: themingTargets.test.ts cannot catch this because its policy is subset (docs may list more than source renders), and @astryx/no-classname-clobber cannot either, because both sides are JSX spreads rather than a literal className attribute. This one was not in the pre-fix row; it surfaced while writing the regression test for T6, which means the recorded before state understates §2 by one BLOCK. The pre-fix row is left as it was measured rather than rewritten.

T6 (BLOCK): the variant never reached the item theme targets

variant selects between StyleX style objects on breadcrumb-item (defaultSize/supportingSize, defaultCurrent/supportingCurrent) and on the menu trigger (defaultLink/supportingLink), and neither themeProps() call carried it.

before  .astryx-breadcrumb-item  data-* attributes: []
after   .astryx-breadcrumb-item  data-* attributes: [data-variant=supporting]

Both targets now reflect it and the docs list it under visualProps. Two regression tests added.

A15 (FIX): the browser's focus ring instead of the system's

The link, the onClick button and the menu trigger all fell through to the Chromium default ring. Core Link routes through the shared focusOutlineProps.focusVisible; Breadcrumbs did not, so a theme's focus accent never reached a crumb.

outline offset
before 1px auto rgb(0, 95, 204) 1px
after 2px solid rgb(0, 100, 224) 3px
SideNavItem, for comparison 2px solid rgb(0, 100, 224) 3px
before after
focus before focus after
focus before dark focus after dark
trigger focus before trigger focus after

Those dark rows are genuine dark renders now. They were not in the previous body.

I10 (BLOCK), in the half that was real: an Icon separator does not mirror itself

The shipped BreadcrumbsCustomSeparator block recommends a chevron, an arrow and a dot, and only the arrow needed anything done to it: → is not bidi-mirrored, so under RTL it kept pointing left to right. It now carries rtlStyles.mirror. The chevron does not, per the correction above. A Mirrored Icon Separator story shows the Icon form, which needs the mirror for the same reason: an SVG is not text and the bidi algorithm does not touch it.

The trail's own RTL geometry was already correct and stays correct: direction resolves to rtl, items run right to left, each separator sits on the leading side of its label, no horizontal scroll. The RTL captures are driven by the direction global now, rather than by setting dir on ancestors by hand.

glyph separator in RTL, ‹ as the engine renders it Icon separator in RTL, mirrored explicitly
rtl glyph rtl icon

This is not unit-testable: jsdom implements no bidi mirroring, so the evidence is the Chromium raster comparison.

V10 (FIX): stories for states that had none

Menu Crumb (disabled item) with a play: function that opens the menu, a long label in a 320px container, and a single-item trail. The disabled row measures cursor: not-allowed, pointer-events: auto, and paints no hover, which is DropdownMenuItem behaving correctly rather than Breadcrumbs coverage, per the correction above.

long labels at 320px single item
long labels single item

disabled menu item

X5b and X16 (FIX): docs

menu and menuSize were documented in BreadcrumbItem.doc.mjs and missing from the duplicate prop list in Breadcrumbs.doc.mjs components[]; the two copies had drifted. Added. bestPractices now names the APG Breadcrumb pattern the component implements and the APG Menu Button pattern the menu crumb implements, which closes A2 as well, and carries the corrected RTL separator rule.

Visual comparison, recaptured

30 before/after pairs, compared per pixel, both sides from a fresh build and both with real light and dark renders. 6 changed, 24 identical at 0.00%.

pair light dark
default, focus-visible 1.55% 1.94%
menu crumb, focus-visible 1.84% 2.27%
menu crumb, open 5.80% 5.71%

The menu movement is the popover repositioning under the trigger's now-padded box. Rest states did not move at all, which is exactly why the 20px hit area went unnoticed by eye. The supporting-variant pair and the RTL separator pair are back at 0.00%, because both of those changes were withdrawn.

Needs review

P8 (BLOCK, still open): menu suppresses href and onClick. This is the one thing P8 forbids: each prop should be one orthogonal axis. It is deliberate, documented, warned at dev time and covered by tests, so the behaviour is predictable. But the prop surface still lets a consumer write a combination the component ignores. The rubric's own guidance is to prefer the type over a runtime guard, which means a discriminated union on BreadcrumbItemProps. That is a public API change and not a fix-pass call, so it is left open and it is what caps the grade at C.

B8 (FIX, open, not this PR's to close): the supporting variant does not mark its current page. Measured, and left to #4605 for #4421. See the correction above.

T7 (FIX): paint is split across two nodes. breadcrumb-item carries the type scale on the <li> while the color sits on the untargeted child link or span. T7 wants these converged onto one painting element. Converging them moves which element a theme paints, which can change what existing themes reach, so it wants a decision rather than a patch.

T26: the current state is not on a theme target. variant now is, but current is not, because auto-detection resolves after mount: an explicitly-current crumb knows at render time and an auto-detected one does not. Reflecting it on only one path would be worse than reflecting it on neither. Doing it properly means deciding whether the auto-detect effect should also write the theme surface.

I17 (FIX): the RTL harness still gives this component no coverage. rtl:audit --filter Breadcrumbs reports 0 pass / 0 fail / 16 N-A both before and after. The harness's curated dimensions are D2 (prev/next control order) and D3 (scroll and drag direction), and a breadcrumb trail has neither, so adding a targets.json entry would invent coverage rather than create it. The RTL behaviour here was measured by hand instead.

aria-disabled through ...rest (NIT). BaseProps<HTMLLIElement> accepts aria-disabled, and it lands on the <li> while the <a> inside keeps cursor: pointer and still paints its hover underline, because the guard is on the anchor and the attribute is on its parent. No doc suggests this and no call site does it, so it is a NIT under the reachable-victim rule rather than an A20/A21 failure. The clean closure is an isDisabled prop, which is a spec decision.

Not scored against this component

A theme cannot restyle .astryx-breadcrumb-menu's radius or padding, and that is #5095. Injecting the rules a theme emits into @layer astryx-theme: color on .astryx-breadcrumb-item reaches the element and font-size does not; background-color on .astryx-breadcrumb-menu reaches it and border-radius and padding do not. DropdownMenu was run as a control and behaves identically, so this is the layer-ordering bug and not a Breadcrumbs defect. The two private vars BreadcrumbItem sets are already classified as cross-component in derivedVarRegistry.test.ts by deliberate decision.

Whether aria-current="page" reaches the accessibility tree is unverified rather than a finding. The current crumb is a bare <span aria-current="page">, which maps to role generic with an empty accessible name. Whether Chrome surfaces the attribute is not measurable over this CDP build: a control page with <a href aria-current="page"> also reported no current property, so the method is blind to it. Settling this wants a real screen reader.

Checks

  • vitest packages/core/src/Breadcrumbs/: 39 passed
  • pnpm test, pnpm build, pnpm lint:strict: clean
  • check:sync, check:changesets, check-use-client, check:package-boundaries and the rest of check:repo: clean
  • Evidence branch: assets/pr-5332 (30 before, 40 after, plus the per-capture render state)

Night Watch — Component Auditor

…rting current state

Findings from the nightly component audit, all measured in Chromium against a
locally built Storybook.

A10: the menu-trigger and onClick-only crumbs rendered a 20px-tall button next
to 28px links, under the 24px WCAG 2.5.8 floor and 8px out of vertical
alignment inside the same trail. buttonReset applied a blanket `padding: 0`
after `link` set paddingBlock, so the block padding was wiped along with the
inline padding it was there to reset. Now paddingInline only.

T12: `breadcrumb-item-menu-trigger` is documented as a theme target but never
reached the DOM. A sibling stylex.props() spread replaced the className that
themeProps() built, so a theme rule for that target matched nothing. Merged
through mergeProps, which is what the rule asks for. The className-clobber lint
rule does not see this shape because both sides are JSX spreads rather than a
literal className attribute.

T6: `variant` selects between style objects on breadcrumb-item and on the menu
trigger, and neither themeProps() call carried it, so .astryx-breadcrumb-item
rendered with no data attribute at all and a theme could not target the
supporting crumb. Both targets now reflect it, and the docs list it under
visualProps.

A15: the link, the onClick button and the menu trigger fell through to the
browser default focus ring instead of the shared focusOutlineProps.focusVisible
that Link uses, so a theme's focus accent never reached a breadcrumb.

B8: with variant="supporting" the current crumb was pixel-identical to a link,
because supportingCurrent and supportingLink both resolved to
--color-text-secondary. It now takes --color-text-primary, matching how the
default variant separates the two.

I10: the shipped custom-separator block recommends a chevron and an arrow, and
neither mirrored under RTL, so a directional separator pointed against the
reading direction. Both now carry rtlStyles.mirror, and the docs say to do that.

Also: stories for a disabled menu item (the A20 and A21 sweeps saw zero
disabled elements on this component before it), a long label in a narrow
container, a single-item trail, and the mirrored icon separator; menu and
menuSize added to the sub-component prop list in Breadcrumbs.doc.mjs, which had
drifted from BreadcrumbItem.doc.mjs; and the APG patterns named in the docs.

Night Watch - Component Auditor
The story taught the same unmirrored directional glyph the block did. Measured
in Chromium: the separator now resolves to matrix(-1, 0, 0, 1, 0, 0) under
dir="rtl" and to none in LTR.

Night Watch - Component Auditor
@vercel

vercel Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 22, 2026 1:44pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 22, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Aug 22, 2026
@cixzhang cixzhang changed the title fix(breadcrumbs): audit pass — hit target, theme targets, focus ring, RTL separators fix(breadcrumbs): audit pass, hit target, theme targets, focus ring, RTL separators Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Breadcrumbs (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 622 -
Complexity N/A Very High (48) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

…nly current state

Review of #5332 found four defects in the audit's own work.

The RTL separator "fix" was a double flip. U+203A has Unicode
Bidi_Mirrored=Yes, so Chromium already mirrors it under RTL and
rtlStyles.mirror flipped it back to pointing the wrong way. The mirror now
applies only where the glyph is not bidi-mirrored: the arrow in the block
template keeps it, the angle-quote chevron in the template and the story does
not, and an Icon separator keeps it because an SVG is never bidi-mirrored.

The supporting variant's current crumb goes back to --color-text-secondary.
Distinguishing the current item by colour alone is the defect in issue #4421,
not the remedy, and #4605 fixes it properly with a non-colour indicator.

pngjs was a dependency of the audit harness, not of the repo, so it leaves
package.json and the lockfile; the harness runs from outside the tree.

Night Watch - Component Auditor
@cixzhang cixzhang changed the title fix(breadcrumbs): audit pass, hit target, theme targets, focus ring, RTL separators fix(breadcrumbs): audit pass, hit target, theme targets, focus ring, RTL separator guidance Aug 22, 2026
github-actions Bot added a commit that referenced this pull request Aug 22, 2026
@cixzhang
cixzhang merged commit 580c1bc into main Aug 22, 2026
19 checks passed
cixzhang added a commit that referenced this pull request Aug 22, 2026
…ead className clobber) (#5334)

* feat(eslint): catch spread-vs-spread className clobbering

Widen no-classname-clobber to the shape it could not see: two JSX spreads
that each carry a className, where the later one silently replaces the
earlier. Adds the rule's first colocated test file.

* docs(eslint): document the widened rule and hold it at warn

The spread check has one violation in the repo — BreadcrumbItem, whose fix
is open in #5332 — so both tiers warn until that lands rather than turning
CI red.
@github-actions
github-actions Bot deleted the night-watch-component-audit/Breadcrumbs/2026-08-22 branch August 23, 2026 06:11

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant