Skip to content

test(rtl): detect contextual decorations and coverage gaps - #5365

Merged
nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/rtl-applicability-contract
Sep 1, 2026
Merged

nynexman4464 merged 1 commit into
mainfrom
nynexman4464/fix/rtl-applicability-contract

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The RTL audit treated an all-N/A result as clean and only auto-detected directional SVG icons. That left contextual text decorations unmeasured: Breadcrumbs could ship an unmirrored separator while reporting 0 pass / 0 fail / all N-A.

The audit roster also came only from rendered stories, so a Core or Lab component without a matching story could disappear instead of surfacing as a coverage gap.

Changes

  • Add D6 auto-discovery for single-glyph, aria-hidden decorations in repeated-item or between-sibling contexts.
  • Distinguish explicit-mirror glyphs (/, \\, arrows, angle brackets) from Unicode bidi-mirrored angle quotes, and reject double handling.
  • Build the applicability roster from all discoverable Core and Lab components, keyed as core/Name or lab/Name.
  • Classify each component as measured, verified N/A, or a coverage gap. Report stale verified-N/A declarations when behavior becomes applicable later.
  • Surface D6 and coverage gaps in PR summaries and the weekly RTL tracking issue.
  • Mirror Breadcrumbs' built-in slash and add rendered slash, angle-quote, and arrow coverage.

Fixes #5364.

The companion monitor contract is live in Night Watch Component Auditor and Component Audit Rubric v1.8.

NOTE: Required visual acceptance is waiting on #5840. The trusted planner runs from main; after #5840 lands and CI reruns, this PR's review contracts from 252 frames to 16 focused frames.

How D6 detects a problematic glyph

D6 does not search globally for characters such as /. A rendered element becomes a candidate only when all of these are true:

  1. It is aria-hidden="true". That tells us the text is decorative rather than content. This is intentional: aria-hidden removes the separator text from the accessibility tree, while role="presentation" on a <span> removes no meaningful role and still exposes / as text.
  2. Its entire trimmed text is one supported glyph, not a sentence, date, URL, path, or fraction containing that character.
  3. The DOM supplies a directional UI context: the decoration is inside one of at least two sibling li/role="listitem" items, or the decoration sits between two sibling elements.
  4. The glyph is visibly rendered. Hidden first-item separators do not count.

That means a Breadcrumbs separator is measured, while and/or, 08/24, /settings, and / in prose are ignored.

For each candidate, D6 renders the same story LTR and RTL, follows nested wrappers to the element that carries the glyph, and composes transforms through its ancestors. It then applies one of two rules:

  • /, \, →, ←, >, and < need explicit handling. They pass if the RTL transform is the horizontal mirror of the LTR transform, or if the DOM swaps to the paired opposite glyph. Neither handling fails; doing both fails as a double flip.
  • ›, ‹, », and « have Unicode Bidi_Mirrored=Yes. They pass when the DOM glyph and transform stay unchanged because the browser mirrors the painted glyph. Swapping or transforming them again fails as double handling.

D6 scans every story for the component, not only its default story. The component-level rollup then classifies each Core and Lab component as measured, verified N/A with a checked-in reason, or a coverage gap.

Visual evidence

The existing Custom Separator story now renders both D6 strategies in one focused canvas:

  • › relies on Unicode bidi mirroring and keeps its DOM glyph and transform unchanged;
  • → uses one explicit horizontal mirror.

The story is tagged visual-baseline; the default Breadcrumbs story remains the representative theme surface. Against the live accepted baseline, the bounded planner produces 16 frames: 14 Default frames across seven themes and two modes, plus two neutral Custom Separator frames. Two already exist and 14 are new. All 16 captured successfully.

D6 still scans every Breadcrumbs story independently of screenshot selection. The rendered mutation test below is the precise regression proof: the old component fails 13 applicable stories, while the fixed component passes all 14.

Test plan

Rendered mutation proof

Before, restored only packages/core/src/Breadcrumbs/BreadcrumbItem.tsx from HEAD^, rebuilt Core and Storybook, then ran:

node apps/storybook/rtl-audit/rtl-audit.mjs \
  --storybook-dir apps/storybook/dist \
  --output /tmp/rtl-breadcrumbs-before.json \
  --filter Breadcrumbs \
  --concurrency 4

Result: exit 1; D6 reported 1 pass, 13 failures, and 2 N/A stories. The consolidated Custom Separator story passed because its two custom strategies are independent of the built-in slash; every applicable built-in-slash story failed as neither mirrored nor swapped.

After restoring HEAD, rebuilding, and running the same audit command with /tmp/rtl-breadcrumbs-after-final.json:

  • exit 0;
  • D6: 14 pass, 0 fail, 2 N/A;
  • Custom Separator: pass with four candidates across its automatic and explicit strategies;
  • core/Breadcrumbs: measured, 0 coverage gaps.

Missing-story coverage

Ran:

node apps/storybook/rtl-audit/rtl-audit.mjs \
  --storybook-dir apps/storybook/dist \
  --output /tmp/rtl-breadcrumb-item-gap.json \
  --filter BreadcrumbItem \
  --concurrency 2

Result: exit 1 with core/BreadcrumbItem reported as a coverage gap instead of disappearing from the audit.

Automated suites

Ran:

pnpm exec vitest run --project node \
  .github/scripts/visual-gate/lib/plan.test.mjs \
  .github/scripts/visual-gate/visual-acceptance.test.mjs \
  .github/scripts/rtl-audit-coverage.test.mjs \
  .github/scripts/weekly-rtl-summary.test.mjs
pnpm exec vitest run --project ui packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx
pnpm lint:strict
pnpm -F @astryxdesign/core build
pnpm -F @astryxdesign/storybook build

Result: 64 planner/audit/monitor tests and 40 Breadcrumbs tests passed. Strict lint, Core build, and Storybook build passed. The trusted 16-frame plan captured 16/16 successfully.

@vercel

vercel Bot commented Aug 23, 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 Sep 1, 2026 7:15pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 23, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Aug 23, 2026
@github-actions

github-actions Bot commented Aug 23, 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 632 -
Complexity N/A Very High (49) -

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

222 added · 0 removed. View the report

A repository maintainer can accept these exact frames: /accept-visual 33547900934/1 <why every changed frame is correct>

Added — After
Added — After visual regression frame

Added — After
Added — After visual regression frame

Added — After
Added — After visual regression frame


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

github-actions Bot added a commit that referenced this pull request Aug 23, 2026
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/rtl-applicability-contract branch from 067f344 to e14db7d Compare August 24, 2026 15:02
@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/rtl-applicability-contract branch from e14db7d to 93a1955 Compare August 24, 2026 15:20
github-actions Bot added a commit that referenced this pull request Aug 24, 2026
github-actions Bot added a commit that referenced this pull request Aug 24, 2026
@nynexman4464
nynexman4464 marked this pull request as ready for review August 25, 2026 19:30

@rubyycheung rubyycheung 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.

Looks good from design. The Breadcrumb separator mirrors correctly in RTL while ordinary slashes in text, dates, and paths remain unchanged. The contextual detection and coverage checks are a good safeguard against future directional-decoration regressions.

@nynexman4464
nynexman4464 force-pushed the nynexman4464/fix/rtl-applicability-contract branch from 93a1955 to d36958d Compare August 31, 2026 23:18
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Aug 31, 2026
github-actions Bot added a commit that referenced this pull request Aug 31, 2026

This branch was successfully deployed

1 active deployment
Preview — 205a7dc9 Deployed Sep 1, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] RTL audit: classify contextual decorations and unexplained N/A coverage

3 participants