Skip to content

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

TypeScript

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

nynexman446469e6f904147e
diff --git a/.changeset/rtl-contextual-separators.md b/.changeset/rtl-contextual-separators.md
new file mode 100644
index 0000000000..45259b5772
--- /dev/null
+++ b/.changeset/rtl-contextual-separators.md
@@ -0,0 +1,9 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Breadcrumbs mirrors its built-in slash separator in right-to-left layouts
+
+Fixes #5364.
+
+@nynexman4464
diff --git a/.github/scripts/rtl-audit-coverage.test.mjs b/.github/scripts/rtl-audit-coverage.test.mjs
new file mode 100644
index 0000000000..f73e48846d
--- /dev/null
+++ b/.github/scripts/rtl-audit-coverage.test.mjs
@@ -0,0 +1,185 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Unit tests for RTL contextual decorations and applicability coverage.
+ */
+
+import {JSDOM} from 'jsdom';
+import {describe, expect, it} from 'vitest';
+import {
+ buildComponentCoverage,
+ classifyDirectionalDecorationPair,
+ collectDirectionalDecorations,
+} from '../../apps/storybook/rtl-audit/rtl-audit-coverage.mjs';
+
+const IDENTITY = [1, 0, 0, 1];
+const MIRROR = [-1, 0, 0, 1];
+
+function decoration(glyph, policy, matrix = IDENTITY) {
+ return {glyph, policy, matrix};
+}
+
+describe('collectDirectionalDecorations', () => {
+ it('detects a slash used between repeated list items', () => {
+ const dom = new JSDOM(`
+ <ol>
+ <li><span aria-hidden="true">/</span><a>Home</a></li>
+ <li><span aria-hidden="true">/</span><a>Docs</a></li>
+ </ol>
+ <p>Control: and/or · 08/24 · /settings</p>
+ `);
+ const found = collectDirectionalDecorations({
+ root: dom.window.document,
+ requireVisible: false,
+ });
+ expect(found).toHaveLength(2);
+ expect(found[0]).toMatchObject({glyph: '/', policy: 'explicit'});
+ });
+
+ it('follows a nested glyph element that carries the mirror transform', () => {
+ const dom = new JSDOM(`
+ <ol>
+ <li><span aria-hidden="true"><span style="transform: matrix(-1, 0, 0, 1, 0, 0)">→</span></span><a>Home</a></li>
+ <li><span aria-hidden="true"><span style="transform: matrix(-1, 0, 0, 1, 0, 0)">→</span></span><a>Docs</a></li>
+ </ol>
+ `);
+ const found = collectDirectionalDecorations({
+ root: dom.window.document,
+ requireVisible: false,
+ });
+ expect(found[0].matrix).toEqual(MIRROR);
+ });
+
+ it('ignores the same slash without a directional decoration context', () => {
+ const dom = new JSDOM('<p aria-hidden="true">/</p><p>and/or</p>');
+ expect(
+ collectDirectionalDecorations({
+ root: dom.window.document,
+ requireVisible: false,
+ }),
+ ).toEqual([]);
+ });
+});
+
+describe('classifyDirectionalDecorationPair', () => {
+ it('fails a bare contextual arrow', () => {
+ expect(
+ classifyDirectionalDecorationPair(
+ decoration('→', 'explicit'),
+ decoration('→', 'explicit'),
+ ),
+ ).toMatchObject({verdict: 'fail'});
+ });
+
+ it('passes a mirrored contextual arrow', () => {
+ expect(
+ classifyDirectionalDecorationPair(
+ decoration('→', 'explicit'),
+ decoration('→', 'explicit', MIRROR),
+ ),
+ ).toMatchObject({verdict: 'pass'});
+ });
+
+ it('passes an unchanged Unicode-mirrored angle quote', () => {
+ expect(
+ classifyDirectionalDecorationPair(
+ decoration('›', 'auto-bidi'),
+ decoration('›', 'auto-bidi'),
+ ),
+ ).toMatchObject({verdict: 'pass'});
+ });
+
+ it('fails an explicitly mirrored Unicode-mirrored angle quote', () => {
+ expect(
+ classifyDirectionalDecorationPair(
+ decoration('›', 'auto-bidi'),
+ decoration('›', 'auto-bidi', MIRROR),
+ ),
+ ).toMatchObject({verdict: 'fail'});
+ });
+});
+
+describe('buildComponentCoverage', () => {
+ it('classifies measured, verified N/A, unexplained gaps, and stale declarations', () => {
+ const coverage = buildComponentCoverage({
+ components: [
+ 'core/Breadcrumbs',
+ 'core/Button',
+ 'core/Text',
+ 'core/Pagination',
+ ],
+ decorationResults: [
+ {
+ component: 'core/Breadcrumbs',
+ storyId: 'core-breadcrumbs--default',
+ verdict: 'pass',
+ },
+ ],
+ autoResults: [
+ {
+ component: 'core/Pagination',
+ storyId: 'core-pagination--default',
+ verdict: 'pass',
+ },
+ ],
+ verifiedNa: [
+ {
+ component: 'core/Text',
+ reason: 'Text has no direction-sensitive visual or behavior.',
+ },
+ {component: 'core/Pagination', reason: 'stale reason'},
+ ],
+ });
+
+ expect(coverage).toMatchObject({
+ total: 4,
+ measured: 1,
+ verifiedNa: 1,
+ gaps: 1,
+ staleVerifiedNa: 1,
+ });
+ expect(
+ Object.fromEntries(
+ coverage.results.map(result => [result.component, result.status]),
+ ),
+ ).toEqual({
+ 'core/Breadcrumbs': 'measured',
+ 'core/Button': 'coverage-gap',
+ 'core/Pagination': 'stale-verified-na',
+ 'core/Text': 'verified-na',
+ });
+ });
+
+ it('keeps missing stories and audit errors as coverage gaps', () => {
+ const coverage = buildComponentCoverage({
+ components: ['core/MissingStory', 'core/BrokenAudit'],
+ autoResults: [
+ {
+ component: 'core/BrokenAudit',
+ storyId: 'core-broken--default',
+ verdict: 'ERROR',
+ },
+ ],
+ curatedResults: [
+ {
+ component: 'core/MissingStory',
+ storyId: 'core-missing--default',
+ rollup: 'MISSING-STORY',
+ },
+ ],
+ });
+ expect(coverage.measured).toBe(0);
+ expect(coverage.gaps).toBe(2);
+ });
+
+ it('keeps same-named Core and Lab components distinct', () => {
+ const coverage = buildComponentCoverage({
+ components: ['core/Chat', 'lab/Chat'],
+ });
+ expect(coverage.results.map(result => result.component)).toEqual([
+ 'core/Chat',
+ 'lab/Chat',
+ ]);
+ expect(coverage.gaps).toBe(2);
+ });
+});
diff --git a/.github/scripts/visual-gate/README.md b/.github/scripts/visual-gate/README.md
index 57c1ea2f4e..82e89964f4 100644
--- a/.github/scripts/visual-gate/README.md
+++ b/.github/scripts/visual-gate/README.md
@@ -72,8 +72,11 @@ Exit codes are the contract: `0` pass, `1` crashed, `2` changed.
`pr-visual` compares only the stable published visual surface:
-- Core component change → every story of that component, light/dark, in every
- shipped theme that styles it.
+- Core component change → the representative story in the default theme and
+ every shipped theme that styles the component, plus any story explicitly
+ tagged `visual-baseline` in the default theme; all are captured light/dark.
+ Behavioral and audit-only fixtures stay in their dedicated checks without
+ multiplying the pixel baseline.
- Published theme change → that theme's relevant target/story matrix.
- Shared stable theming/token infrastructure → the full plan, which declines
visibly at the 240-shot review budget and defers to the daily gate.
diff --git a/.github/scripts/visual-gate/lib/plan.mjs b/.github/scripts/visual-gate/lib/plan.mjs
index 6e32ddfdd1..b33f793fba 100644
--- a/.github/scripts/visual-gate/lib/plan.mjs
+++ b/.github/scripts/visual-gate/lib/plan.mjs
@@ -43,6 +43,9 @@ export const MODES = ['light', 'dark'];
/** Story names preferred as a component's representative, most preferred first. */
const REPRESENTATIVE_NAMES = ['Default', 'Basic', 'Primary', 'Overview', 'Example'];
+/** A story carrying this tag is always captured for a touched component. */
+export const VISUAL_BASELINE_TAG = 'visual-baseline';
+
/** A story carrying this tag is never captured (see visual-gate.config.json for the reasoned list). */
export const SKIP_TAG = 'no-visual';
@@ -442,9 +445,10 @@ export function buildPlan({
}
if (tiers.includes('component')) {
- // The PR tier: every story of the named components, in the default theme
- // and in every theme that styles them. Deeper than `surface` (which shoots
- // one story per component), and narrow enough to run per PR.
+ // The PR tier: one representative story in every theme that styles the
+ // touched component, plus explicit visual-baseline opt-ins in the default
+ // theme. Behavioral and audit-only fixtures remain available to their
+ // dedicated checks without multiplying the pixel baseline.
const themesByComponent = new Map();
for (const target of targets) {
for (const [theme, keys] of Object.entries(themeOverrides)) {
@@ -455,10 +459,18 @@ export function buildPlan({
themesByComponent.get(target.component).add(theme);
}
}
- for (const story of stories) {
- if (!components.includes(story.component)) continue;
+ const subject = stories.filter(
+ story =>
+ components.includes(story.component) &&
+ (representatives.get(story.component)?.id === story.id ||
+ (story.tags ?? []).includes(VISUAL_BASELINE_TAG)),
+ );
+ for (const story of subject) {
+ const isRepresentative =
+ representatives.get(story.component)?.id === story.id;
for (const mode of MODES) {
add({...toShotBase(story), theme: defaultTheme, mode}, 'component');
+ if (!isRepresentative) continue;
for (const theme of themesByComponent.get(story.component) ?? []) {
if (theme === defaultTheme) continue;
add({...toShotBase(story), theme, mode}, `theme:${theme}`);
diff --git a/.github/scripts/visual-gate/lib/plan.test.mjs b/.github/scripts/visual-gate/lib/plan.test.mjs
index 63768d468a..db675ab57c 100644
--- a/.github/scripts/visual-gate/lib/plan.test.mjs
+++ b/.github/scripts/visual-gate/lib/plan.test.mjs
@@ -116,6 +116,26 @@ describe('buildPlan', () => {
expect(plan.some(shot => shot.theme === 'y2k' && shot.component === 'Button')).toBe(true);
});
+ it('limits touched components to representative and opted-in stories', () => {
+ const componentStories = [
+ ...stories,
+ story({id: 'core-button--separator', title: 'Core/Button', name: 'Separator', component: 'Button', tags: ['visual-baseline']}),
+ story({id: 'core-button--fixture', title: 'Core/Button', name: 'Fixture', component: 'Button'}),
+ ];
+ const plan = buildPlan({
+ stories: componentStories,
+ targets,
+ themeOverrides,
+ defaultTheme: 'neutral',
+ tiers: ['component'],
+ components: ['Button'],
+ });
+ expect(new Set(plan.map(shot => shot.storyId))).toEqual(
+ new Set(['core-button--default', 'core-button--separator']),
+ );
+ expect(plan).toHaveLength(6);
+ });
+
it('records why a shot is in the plan, merging the reasons of a shot both tiers want', () => {
const plan = buildPlan({stories, targets, themeOverrides, defaultTheme: 'neutral', tiers: ['surface', 'theme-matrix']});
const shot = plan.find(candidate => candidate.key === 'core-button--default__neutral-light');
diff --git a/.github/scripts/visual-gate/visual-acceptance.mjs b/.github/scripts/visual-gate/visual-acceptance.mjs
index 3209bb8018..8a51a49281 100644
--- a/.github/scripts/visual-gate/visual-acceptance.mjs
+++ b/.github/scripts/visual-gate/visual-acceptance.mjs
@@ -22,9 +22,11 @@ import {canonicalizePng} from './lib/canonical-png.mjs';
import {
readStoryIndex,
readThemeCatalog,
+ representativeStories,
shotKey,
stableBaseline,
storiesInPackages,
+ VISUAL_BASELINE_TAG,
withThemeMetadata,
} from './lib/plan.mjs';
import {renderReport} from './lib/report.mjs';
@@ -749,13 +751,27 @@ function trustedPlan() {
};
const componentStories = new Map();
+ const representatives = representativeStories(indexed);
for (const story of indexedStories.values()) {
- if (scope.stableComponents.includes(story.component)) {
- componentStories.set(story.storyId ?? story.id, story);
+ const isRepresentative =
+ representatives.get(story.component)?.id === story.id;
+ if (
+ scope.stableComponents.includes(story.component) &&
+ (isRepresentative ||
+ (story.tags ?? []).includes(VISUAL_BASELINE_TAG))
+ ) {
+ componentStories.set(story.storyId ?? story.id, {
+ isRepresentative,
+ story,
+ });
}
}
- for (const story of componentStories.values()) {
- for (const theme of baselineThemes) add(story, theme);
+ for (const {isRepresentative, story} of componentStories.values()) {
+ add(story, config.defaultTheme);
+ if (!isRepresentative) continue;
+ for (const theme of baselineThemes) {
+ if (theme !== config.defaultTheme) add(story, theme);
+ }
}
for (const theme of scope.stableThemes) {
diff --git a/.github/scripts/visual-gate/visual-acceptance.test.mjs b/.github/scripts/visual-gate/visual-acceptance.test.mjs
index 7b96e4da5e..e868fb0da7 100644
--- a/.github/scripts/visual-gate/visual-acceptance.test.mjs
+++ b/.github/scripts/visual-gate/visual-acceptance.test.mjs
@@ -506,8 +506,38 @@ describe('visual acceptance', () => {
componentPath: '../../packages/core/src/Button/index.ts',
tags: [],
},
+ separator: {
+ type: 'story',
+ id: 'core-button--separator',
+ title: 'Core/Button',
+ name: 'Separator',
+ componentPath: '../../packages/core/src/Button/index.ts',
+ tags: ['visual-baseline'],
+ },
+ fixture: {
+ type: 'story',
+ id: 'core-button--interaction-fixture',
+ title: 'Core/Button',
+ name: 'Interaction Fixture',
+ componentPath: '../../packages/core/src/Button/index.ts',
+ tags: [],
+ },
},
});
+ const baselineFile = path.join(
+ pages,
+ 'visual-gate',
+ 'baseline',
+ 'manifest.json',
+ );
+ const baseline = JSON.parse(fs.readFileSync(baselineFile, 'utf8'));
+ baseline.shots['core-button--default__y2k-light'] = {
+ ...baseline.shots[KEY],
+ key: 'core-button--default__y2k-light',
+ theme: 'y2k',
+ mode: 'light',
+ };
+ writeJSON(baselineFile, baseline);
const scope = path.join(root, 'scope.json');
writeJSON(scope, {
hasStableVisual: true,
@@ -527,6 +557,10 @@ describe('visual acceptance', () => {
).toEqual([
'core-button--default__neutral-light',
'core-button--default__neutral-dark',
+ 'core-button--default__y2k-light',
+ 'core-button--default__y2k-dark',
+ 'core-button--separator__neutral-light',
+ 'core-button--separator__neutral-dark',
]);
});
diff --git a/.github/scripts/weekly-rtl-summary.js b/.github/scripts/weekly-rtl-summary.js
index 0f717c3133..8c71febb2a 100644
--- a/.github/scripts/weekly-rtl-summary.js
+++ b/.github/scripts/weekly-rtl-summary.js
@@ -6,15 +6,17 @@
* scan workflow. Reads the JSON report produced by rtl-audit.mjs, writes a
* markdown summary (used for both the GitHub step summary and the tracking
* issue body), and emits step outputs (status, total_findings,
- * components_audited, stories_scanned) so the workflow can decide whether to
- * open-or-update the tracking issue and whether to fail the job.
+ * components_audited, stories_scanned, coverage_gaps, verified_na) so the
+ * workflow can decide whether to open-or-update the tracking issue and
+ * whether to fail the job.
* @input --report <file> --audit-outcome <success|failure> --summary-output <file>
* [--github-output <file>]
* @output Markdown summary file + GitHub Actions step outputs
*
* Status semantics:
- * clean — report present with zero findings
- * findings — report present, at least one D1/D5/curated finding
+ * clean: report present with zero behavior findings or coverage gaps
+ * findings: report present with a D1/D5/D6/curated finding, an unexplained
+ * all-N/A component, or a stale verified-N/A declaration
* crashed — no usable report (the audit died before writing one)
*
* Unlike accessibility-audit.js, rtl-audit.mjs exits non-zero on ANY finding,
@@ -64,11 +66,20 @@ function curatedFailuresOf(report) {
);
}
+function coverageFindingsOf(report) {
+ return (report?.coverage?.results || []).filter(result =>
+ ['coverage-gap', 'stale-verified-na'].includes(result.status),
+ );
+}
+
function countFindings(report) {
return (
failuresOf(report?.autoDiscovery).length +
failuresOf(report?.positionalMirror).length +
- curatedFailuresOf(report).length
+ failuresOf(report?.directionalDecorations).length +
+ curatedFailuresOf(report).length +
+ coverageFindingsOf(report).length +
+ (report?.coverage?.registryError ? 1 : 0)
);
}
@@ -101,11 +112,14 @@ function buildSummary(report, status) {
const auto = report.autoDiscovery || {};
const pm = report.positionalMirror || {};
+ const decorations = report.directionalDecorations || {};
+ const coverage = report.coverage || {};
const curated = report.curated?.results || [];
lines.push(
- `**Scope:** full component library, unfiltered — ${auto.total ?? 0} component(s) for D1, ` +
- `${pm.total ?? 0} core stories for D5 (${report.generatedAt || 'unknown'}).`,
+ `**Scope:** full component library, unfiltered: ${coverage.total ?? auto.total ?? 0} component(s), ` +
+ `${pm.total ?? 0} story render(s) for D5 and ${decorations.total ?? 0} for D6 ` +
+ `(${report.generatedAt || 'unknown'}).`,
'',
"PR CI (`ci.yml`'s `pr-rtl` job) only audits the components a PR touches. " +
'Tokens, shared hooks, and icon primitives can regress RTL in components ' +
@@ -124,6 +138,8 @@ function buildSummary(report, status) {
lines.push(
`**D1 icon-mirror:** ${auto.pass ?? 0} pass · ${auto.fail ?? 0} not-RTL · ${auto.na ?? 0} N-A.`,
`**D5 positional-mirror:** ${pm.pass ?? 0} pass · ${pm.fail ?? 0} FAIL · ${pm.na ?? 0} N-A (tolerance ${pm.tolerancePx ?? '?'}px).`,
+ `**D6 directional-decoration:** ${decorations.pass ?? 0} pass · ${decorations.fail ?? 0} FAIL · ${decorations.na ?? 0} N-A.`,
+ `**Applicability:** ${coverage.measured ?? 0} measured · ${coverage.verifiedNa ?? 0} verified N-A · ${coverage.gaps ?? 0} coverage gap · ${coverage.staleVerifiedNa ?? 0} stale verified N-A.`,
'',
);
@@ -168,6 +184,48 @@ function buildSummary(report, status) {
lines.push(...truncateRows(rows), '');
}
+ const decorationFails = failuresOf(decorations);
+ if (decorationFails.length) {
+ lines.push('### D6: contextual directional decorations', '');
+ lines.push('| Story | Verdict | Detail |', '|-------|---------|--------|');
+ lines.push(
+ ...truncateRows(
+ decorationFails.map(
+ result =>
+ `| ${result.storyId} | ${result.verdict} | ${(result.notes || []).join('; ')} |`,
+ ),
+ ),
+ '',
+ );
+ }
+
+ const coverageFindings = coverageFindingsOf(report);
+ if (coverage.registryError) {
+ lines.push(
+ '### RTL applicability registry error',
+ '',
+ `\`${coverage.registryError}\``,
+ '',
+ );
+ }
+ if (coverageFindings.length) {
+ lines.push('### RTL coverage gaps', '');
+ lines.push(
+ '| Component | Status | Detail |',
+ '|-----------|--------|--------|',
+ );
+ lines.push(
+ ...truncateRows(
+ coverageFindings.map(result => {
+ const detail =
+ result.note || result.reason || 'unexplained all-N/A result';
+ return `| ${result.component} | ${result.status} | ${detail} |`;
+ }),
+ ),
+ '',
+ );
+ }
+
const curatedFails = curatedFailuresOf(report);
if (curatedFails.length) {
lines.push(
@@ -194,9 +252,9 @@ function buildSummary(report, status) {
if (status === 'clean') {
lines.push(
- `_No findings. ${curated.length} curated target(s) checked._`,
+ `_No findings. ${curated.length} curated target(s) checked; ${coverage.measured ?? 0} component(s) measured and ${coverage.verifiedNa ?? 0} verified N-A, with 0 coverage gaps._`,
'',
- 'RTL-ready across the full library for every dimension the audit covers.',
+ 'RTL-ready across the full library for every applicable or explicitly non-applicable component.',
'',
);
}
@@ -214,8 +272,10 @@ function writeOutputs(status, report) {
const outputs = [
`status=${status}`,
`total_findings=${report ? countFindings(report) : 0}`,
- `components_audited=${report?.autoDiscovery?.total ?? 0}`,
+ `components_audited=${report?.coverage?.total ?? report?.autoDiscovery?.total ?? 0}`,
`stories_scanned=${report?.positionalMirror?.total ?? 0}`,
+ `coverage_gaps=${report?.coverage?.gaps ?? 0}`,
+ `verified_na=${report?.coverage?.verifiedNa ?? 0}`,
];
if (githubOutputFile)
fs.appendFileSync(githubOutputFile, outputs.join('\n') + '\n');
diff --git a/.github/scripts/weekly-rtl-summary.test.mjs b/.github/scripts/weekly-rtl-summary.test.mjs
new file mode 100644
index 0000000000..9dc011a524
--- /dev/null
+++ b/.github/scripts/weekly-rtl-summary.test.mjs
@@ -0,0 +1,112 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Tests for weekly RTL coverage-gap reporting.
+ */
+
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import {spawnSync} from 'node:child_process';
+import {afterEach, describe, expect, it} from 'vitest';
+
+const SCRIPT = path.resolve('.github/scripts/weekly-rtl-summary.js');
+const dirs = [];
+
+afterEach(() => {
+ for (const dir of dirs.splice(0)) {
+ fs.rmSync(dir, {recursive: true, force: true});
+ }
+});
+
+function runSummary(report) {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'rtl-weekly-summary-'));
+ dirs.push(dir);
+ const reportPath = path.join(dir, 'report.json');
+ const summaryPath = path.join(dir, 'summary.md');
+ const outputPath = path.join(dir, 'output.txt');
+ fs.writeFileSync(reportPath, JSON.stringify(report));
+ const result = spawnSync(
+ process.execPath,
+ [
+ SCRIPT,
+ '--report',
+ reportPath,
+ '--audit-outcome',
+ 'success',
+ '--summary-output',
+ summaryPath,
+ '--github-output',
+ outputPath,
+ ],
+ {encoding: 'utf8'},
+ );
+ return {
+ ...result,
+ summary: fs.readFileSync(summaryPath, 'utf8'),
+ output: fs.readFileSync(outputPath, 'utf8'),
+ };
+}
+
+function baseReport(coverage) {
+ return {
+ generatedAt: '2026-08-23T00:00:00.000Z',
+ autoDiscovery: {total: 1, pass: 0, fail: 0, na: 1, results: []},
+ positionalMirror: {total: 1, pass: 0, fail: 0, na: 1, results: []},
+ directionalDecorations: {total: 1, pass: 0, fail: 0, na: 1, results: []},
+ curated: {results: []},
+ coverage,
+ };
+}
+
+describe('weekly RTL coverage reporting', () => {
+ it('treats an unexplained all-N/A component as a finding', () => {
+ const result = runSummary(
+ baseReport({
+ enforced: true,
+ total: 1,
+ measured: 0,
+ verifiedNa: 0,
+ gaps: 1,
+ staleVerifiedNa: 0,
+ results: [
+ {
+ component: 'core/Button',
+ status: 'coverage-gap',
+ note: 'all dimensions are N-A and no verified-N/A reason is recorded',
+ },
+ ],
+ }),
+ );
+ expect(result.status).toBe(0);
+ expect(result.output).toContain('status=findings');
+ expect(result.output).toContain('coverage_gaps=1');
+ expect(result.summary).toContain('RTL coverage gaps');
+ expect(result.summary).toContain('| core/Button |');
+ expect(result.summary).not.toContain('RTL-ready across the full library');
+ });
+
+ it('allows a component with a recorded verified-N/A reason', () => {
+ const result = runSummary(
+ baseReport({
+ enforced: true,
+ total: 1,
+ measured: 0,
+ verifiedNa: 1,
+ gaps: 0,
+ staleVerifiedNa: 0,
+ results: [
+ {
+ component: 'core/Text',
+ status: 'verified-na',
+ reason: 'No direction-sensitive visual or behavior.',
+ },
+ ],
+ }),
+ );
+ expect(result.status).toBe(0);
+ expect(result.output).toContain('status=clean');
+ expect(result.output).toContain('verified_na=1');
+ expect(result.summary).toContain('0 coverage gap');
+ });
+});
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 193f5042a8..5f38e1efa3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -622,14 +622,15 @@ jobs:
- name: Verify guest fixture contrast
run: pnpm -F @astryxdesign/vibe-tests fixtures:contrast
- # Stable-package visual regression. Core components get every story in
- # every shipped theme that styles them; a changed shipped theme gets its
- # relevant matrix. Packages marked `astryx.canaryOnly` (Lab, charts,
+ # Stable-package visual regression. Core components get one representative
+ # story in every shipped theme that styles them, plus explicit
+ # `visual-baseline` stories in the default theme; a changed shipped theme gets
+ # its relevant matrix. Packages marked `astryx.canaryOnly` (Lab, charts,
# richtext, vega) do not compare pixels and do not own a baseline.
#
- # Deeper than the daily gate where it looks: the release gate shoots ONE
- # representative story per component, this shoots EVERY story of the touched
- # component in EVERY theme that styles it.
+ # Deeper than the daily gate only where the component declares it: audit and
+ # interaction fixtures stay available to their dedicated checks without
+ # multiplying the pixel baseline.
#
# SKIPS ITSELF WHEN A PR IS TOO BROAD (--max-shots). A token or shared-hook
# change puts hundreds of diffs in front of a reviewer who cannot judge them
@@ -765,8 +766,10 @@ jobs:
# Unscoped this swept ~1400 stories and took ~26 min. The full sweep that
# covers untouched components runs in rtl-weekly.yml.
#
- # Two layers: (A) auto-discovery — D1 icon-mirror + D5 positional-mirror, no
- # curated selectors; (B) curated D2/D3/D4 from targets.json.
+ # Three auto dimensions: D1 icon-mirror, D5 positional-mirror, and D6
+ # contextual directional decorations. Curated D2/D3/D4 adds behavior that
+ # needs selectors. The applicability rollup treats unexplained all-N/A as a
+ # coverage gap for both new and existing components.
#
# SOFT / NON-BLOCKING (continue-on-error): findings surface a scorecard in the
# job summary but don't block the merge, while the suite is observed for
@@ -838,9 +841,9 @@ jobs:
const a = r.autoDiscovery;
const known = new Set(r.knownNotRtl || []);
const out = [];
- out.push("### Auto-discovery (D1 icon-mirror, all core stories)");
+ out.push("### Auto-discovery (D1 icon-mirror, one representative story per scoped component)");
out.push("");
- out.push(`**${a.pass} pass · ${a.fail} not-RTL · ${a.na} N-A** (of ${a.total} core components). Surprises (not pre-labelled): **${a.surprises.length}**${a.surprises.length ? " — " + a.surprises.join(", ") : ""}.`);
+ out.push(`**${a.pass} pass · ${a.fail} not-RTL · ${a.na} N-A** (of ${a.total} scoped components). Surprises (not pre-labelled): **${a.surprises.length}**${a.surprises.length ? ": " + a.surprises.join(", ") : ""}.`);
out.push("");
const fails = a.results.filter(x => x.verdict === "fail" || x.verdict === "ERROR");
if (fails.length) {
@@ -859,11 +862,11 @@ jobs:
out.push("");
const pm = r.positionalMirror;
if (pm) {
- out.push("### Positional-mirror (D5, all core stories)");
+ out.push("### Positional-mirror (D5, all scoped stories)");
out.push("");
out.push("Catches a logical anchor (insetInlineStart/End) paired with an UNFLIPPED physical transform (translate/translateX) → element lands on the wrong side in RTL. Lint can\u2019t see this (each prop is individually fine). Tolerance " + pm.tolerancePx + "px, degenerate-parent guard (<8px) applied.");
out.push("");
- out.push(`**${pm.pass} pass · ${pm.fail} FAIL · ${pm.na} N-A** (of ${pm.total} core stories scanned).`);
+ out.push(`**${pm.pass} pass · ${pm.fail} FAIL · ${pm.na} N-A** (of ${pm.total} scoped stories scanned).`);
out.push("");
const pmFails = pm.results.filter(x => x.verdict === "fail" || x.verdict === "ERROR");
if (pmFails.length) {
@@ -881,6 +884,36 @@ jobs:
out.push("");
}
}
+ const decorations = r.directionalDecorations;
+ if (decorations) {
+ out.push("### Contextual directional decorations (D6, all stories)");
+ out.push("");
+ out.push(`**${decorations.pass} pass · ${decorations.fail} FAIL · ${decorations.na} N-A** (of ${decorations.total} stories scanned).`);
+ out.push("");
+ const decorationFails = decorations.results.filter(x => x.verdict === "fail" || x.verdict === "ERROR");
+ if (decorationFails.length) {
+ out.push("| Story | D6 | Detail |");
+ out.push("|-------|----|--------|");
+ for (const c of decorationFails) out.push(`| ${c.storyId} | ${c.verdict} | ${(c.notes||[]).join("; ")} |`);
+ } else {
+ out.push("_No directional-decoration FAILs._");
+ }
+ out.push("");
+ }
+ const coverage = r.coverage;
+ if (coverage) {
+ out.push("### Applicability coverage");
+ out.push("");
+ out.push(`**${coverage.measured} measured · ${coverage.verifiedNa} verified N-A · ${coverage.gaps} coverage gap · ${coverage.staleVerifiedNa} stale verified N-A.**`);
+ out.push("");
+ const gaps = coverage.results.filter(x => x.status === "coverage-gap" || x.status === "stale-verified-na");
+ if (gaps.length) {
+ out.push("| Component | Status | Detail |");
+ out.push("|-----------|--------|--------|");
+ for (const c of gaps) out.push(`| ${c.component} | ${c.status} | ${c.note || c.reason || "unexplained all-N/A result"} |`);
+ out.push("");
+ }
+ }
out.push("### Curated precision (D2 order / D3 behavior / D4 overlay)");
out.push("");
out.push("| Component | Rollup | Dimensions |");
diff --git a/.github/workflows/rtl-weekly.yml b/.github/workflows/rtl-weekly.yml
index bf8afb3844..c1af6b236d 100644
--- a/.github/workflows/rtl-weekly.yml
+++ b/.github/workflows/rtl-weekly.yml
@@ -40,6 +40,8 @@ jobs:
total_findings: ${{ steps.summarize.outputs.total_findings }}
components_audited: ${{ steps.summarize.outputs.components_audited }}
stories_scanned: ${{ steps.summarize.outputs.stories_scanned }}
+ coverage_gaps: ${{ steps.summarize.outputs.coverage_gaps }}
+ verified_na: ${{ steps.summarize.outputs.verified_na }}
steps:
- name: Checkout
uses: actions/checkout@v7
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9cc3f98c46..be11335a1f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -474,8 +474,11 @@ When the audit reports baseline entries as "resolved", delete them from
PRs that touch components also run an RTL audit (`pr-rtl`), scoped to the
changed components like `pr-a11y`. It is soft-gated — findings show in the job
summary but don't block. Repro locally with `pnpm rtl:audit -- --filter Avatar`
-(the `--` matters: `pnpm -F` is itself `--filter`). See
-`apps/storybook/rtl-audit/README.md`.
+(the `--` matters: `pnpm -F` is itself `--filter`). The report classifies every
+scoped component as **measured**, **verified N-A**, or a **coverage gap**; an
+unexplained all-N-A result is not a clean RTL result. The weekly unfiltered run
+applies the same contract to the full existing roster, while PR CI applies it
+to new and changed components. See `apps/storybook/rtl-audit/README.md`.
### Modal close visibility guard
diff --git a/apps/storybook/rtl-audit/README.md b/apps/storybook/rtl-audit/README.md
index 265ee1e130..fa283a85cb 100644
--- a/apps/storybook/rtl-audit/README.md
+++ b/apps/storybook/rtl-audit/README.md
@@ -9,13 +9,14 @@ differences. It reuses the `@playwright/test` chromium the `pr-a11y` job already
installs and mirrors that job's build-storybook → serve → drive shape. In CI it
is the `pr-rtl` job — the RTL sibling of `pr-a11y`.
-## Two layers
+## Three layers
### A. Auto-discovery — over every `core-*` and `lab-*` story in scope
The point of the audit is to auto-catch **new or changed** components, so the
-auto-discovery layer runs with **zero curated selectors**. There are two
-independent auto passes: **D1 (icon-mirror)** and **D5 (positional-mirror)**.
+auto-discovery layer runs with **zero curated selectors**. There are three
+independent auto passes: **D1 (icon-mirror)**, **D5 (positional-mirror)**, and
+**D6 (directional-decoration)**.
> **Scope in CI.** `pr-rtl` passes `--filter` with the components the PR
> touched (from `analysis.json`), matching `pr-a11y`. The full unfiltered sweep
@@ -69,7 +70,7 @@ because their embedded Calendar chevrons mirror once the popover is open.
### A.2 D5 positional-mirror
-A second auto pass, over **every** core story, that catches a bug class D1 and
+A second auto pass, over **every** audited-package story, that catches a bug class D1 and
the `@astryx/no-physical-properties` **lint both miss**: an element positioned
with a **logical anchor** (`insetInlineStart` / `insetInlineEnd`, which _does_
flip under RTL) paired with an **unflipped physical transform**
@@ -161,6 +162,31 @@ flagged. The bug only exists in the **interaction** of the two at layout time,
which is visible only by comparing the rendered LTR vs RTL geometry — exactly
what D5 does.
+### A.3 D6 directional-decoration
+
+Text can be directional because of its **role in the UI**, not only because of
+the character itself. `/` in prose is neutral; the same `/` rendered as an
+`aria-hidden` separator between repeated breadcrumb items communicates forward
+progress and must mirror.
+
+D6 runs over every story and auto-discovers only strong decoration contexts:
+
+- the element is `aria-hidden="true"`;
+- its trimmed content is one supported glyph; and
+- it belongs to repeated list items or sits between sibling elements.
+
+That context prevents ordinary prose, dates, fractions, and paths from becoming
+false positives. D6 then applies the glyph's actual bidi contract:
+
+- `/`, `\\`, `→`, `←`, `>`, and `<` require exactly one explicit transform
+ mirror or a left/right glyph swap;
+- `›`, `‹`, `»`, and `«` have Unicode `Bidi_Mirrored=Yes`, so the browser
+ mirrors an unchanged glyph. Swapping or transforming them again is a failure.
+
+D6 returns **N-A** when a story contains no contextual decoration. The
+applicability layer below decides whether that N-A is explained; D6 itself does
+not turn absence into a pass.
+
### B. Curated precision — D2 / D3 / D4
`targets.json` holds the geometry/behavior dimensions that genuinely need
@@ -172,8 +198,41 @@ hand-written selectors, run **in addition** to auto-discovery:
axis: "next" makes `scrollLeft` go positive in LTR and negative in RTL.
- **D4 overlay-side** — a positioned affordance flips side (`boundingBox`).
-D1 is intentionally **not** in `targets.json` — auto-discovery covers it
-universally.
+D1 and D6 are intentionally **not** in `targets.json`; auto-discovery covers
+them universally.
+
+### C. Applicability: no unexplained all-N/A components
+
+The report rolls every component in the live Core and Lab source roster into one
+of three states:
+
+- **measured**: at least one D1/D5/D6 or curated dimension was applicable;
+- **verified N-A**: `verified-not-applicable.json` records a specific reason
+ the component has no direction-sensitive visual, layout, or behavior;
+- **coverage gap**: every dimension returned N-A and no reason is recorded.
+
+Coverage gaps are findings. This rule applies to the existing full-library
+weekly sweep and to every new or changed component in PR CI. A component with no
+story is also a gap when it is named by `--filter`; it cannot disappear from the
+report merely because there was nothing to render.
+
+A verified-N/A declaration is not an allowlist. If an automatic or curated
+dimension later becomes applicable, the declaration is reported as
+**stale-verified-na** and must be removed or replaced with real coverage.
+
+Add a declaration only after reading the component's source and every story:
+
+```json
+[
+ {
+ "component": "core/Text",
+ "reason": "No direction-sensitive visual, positioned element, order, scroll, drag, overlay, or keyboard behavior."
+ }
+]
+```
+
+An all-N/A scorecard without such a checked-in reason means **unmeasured**, not
+RTL-ready.
## Why relationship-based, not pixel baselines
@@ -217,8 +276,10 @@ pnpm rtl:audit -- --auto-only
pnpm rtl:audit -- --curated-only
```
-Exit code is non-zero if auto-discovery finds any not-RTL component or a curated
-dim fails — but the CI job is soft (see below), so this never hard-blocks.
+Exit code is non-zero if auto-discovery finds a not-RTL component, a curated
+dimension fails, the applicability registry is invalid, or a full-mode run has
+a coverage gap or stale verified-N/A declaration. CI remains soft-gated (see
+below), so the signal does not hard-block yet.
## Adding a curated target
diff --git a/apps/storybook/rtl-audit/rtl-audit-coverage.mjs b/apps/storybook/rtl-audit/rtl-audit-coverage.mjs
new file mode 100644
index 0000000000..0ed0546a4d
--- /dev/null
+++ b/apps/storybook/rtl-audit/rtl-audit-coverage.mjs
@@ -0,0 +1,361 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Shared RTL coverage and directional-decoration helpers.
+ * @input Rendered DOM decorations plus D1/D5/D6/curated audit results.
+ * @output Contextual decoration candidates, pair verdicts, and per-component
+ * measured / verified-N-A / coverage-gap classifications.
+ * @position Pure support layer for rtl-audit.mjs and its unit tests.
+ */
+
+const EXPLICIT_GLYPH_PAIRS = new Map([
+ ['/', '\\'],
+ ['\\', '/'],
+ ['→', '←'],
+ ['←', '→'],
+ ['>', '<'],
+ ['<', '>'],
+]);
+
+/**
+ * Find single-glyph, aria-hidden decorations only when the DOM supplies a
+ * directional context. A slash in prose is ignored; a slash attached to one of
+ * several repeated list items is a separator and is measured.
+ *
+ * This function is passed directly to Playwright's page.evaluate(), so every
+ * browser-side helper intentionally lives inside its body.
+ */
+export function collectDirectionalDecorations({
+ root = globalThis.document,
+ requireVisible = true,
+} = {}) {
+ if (!root?.querySelectorAll) {
+ return [];
+ }
+
+ const candidateGlyphs = new Set([
+ '/',
+ '\\',
+ '→',
+ '←',
+ '>',
+ '<',
+ '›',
+ '‹',
+ '»',
+ '«',
+ ]);
+ const autoBidiGlyphs = new Set(['›', '‹', '»', '«']);
+ const view =
+ root.defaultView ?? root.ownerDocument?.defaultView ?? globalThis;
+
+ function multiply(m, n) {
+ return [
+ m[0] * n[0] + m[2] * n[1],
+ m[1] * n[0] + m[3] * n[1],
+ m[0] * n[2] + m[2] * n[3],
+ m[1] * n[2] + m[3] * n[3],
+ ];
+ }
+
+ function composedMatrixFor(start) {
+ let matrix = [1, 0, 0, 1];
+ let element = start;
+ let steps = 0;
+ while (element && steps < 6) {
+ const transform = view.getComputedStyle?.(element)?.transform;
+ const match = transform?.match(/matrix\(([^)]+)\)/);
+ if (match) {
+ const values = match[1]
+ .split(',')
+ .map(value => Number.parseFloat(value.trim()));
+ matrix = multiply([values[0], values[1], values[2], values[3]], matrix);
+ }
+ element = element.parentElement;
+ steps += 1;
+ }
+ return matrix;
+ }
+
+ function repeatedItemContext(element) {
+ const item = element.closest('li,[role="listitem"]');
+ const parent = item?.parentElement;
+ if (!item || !parent) {
+ return null;
+ }
+ const items = Array.from(parent.children).filter(child =>
+ child.matches('li,[role="listitem"]'),
+ );
+ if (items.length < 2) {
+ return null;
+ }
+ return {
+ kind: 'repeated-item',
+ itemIndex: items.indexOf(item),
+ itemCount: items.length,
+ };
+ }
+
+ function betweenSiblingsContext(element) {
+ const parent = element.parentElement;
+ if (!parent) {
+ return null;
+ }
+ const siblings = Array.from(parent.children);
+ const index = siblings.indexOf(element);
+ if (index <= 0 || index >= siblings.length - 1) {
+ return null;
+ }
+ return {
+ kind: 'between-siblings',
+ itemIndex: index,
+ itemCount: siblings.length,
+ };
+ }
+
+ const candidates = [];
+ for (const element of root.querySelectorAll('[aria-hidden="true"]')) {
+ const glyph = element.textContent?.trim() ?? '';
+ if (!candidateGlyphs.has(glyph)) {
+ continue;
+ }
+ const context =
+ repeatedItemContext(element) ?? betweenSiblingsContext(element);
+ if (!context) {
+ continue;
+ }
+ let glyphElement = element;
+ while (
+ glyphElement.children.length === 1 &&
+ glyphElement.children[0].textContent?.trim() === glyph
+ ) {
+ glyphElement = glyphElement.children[0];
+ }
+ if (requireVisible) {
+ const box = glyphElement.getBoundingClientRect();
+ if (box.width < 1 || box.height < 1) {
+ continue;
+ }
+ }
+ candidates.push({
+ index: candidates.length,
+ glyph,
+ policy: autoBidiGlyphs.has(glyph) ? 'auto-bidi' : 'explicit',
+ context,
+ matrix: composedMatrixFor(glyphElement),
+ });
+ }
+ return candidates;
+}
+
+function matricesEqual(left, right) {
+ return (
+ Array.isArray(left) &&
+ Array.isArray(right) &&
+ left.length === 4 &&
+ right.length === 4 &&
+ left.every((value, index) => Math.abs(value - right[index]) < 0.01)
+ );
+}
+
+function isMirrorOf(rtl, ltr) {
+ if (!Array.isArray(rtl) || !Array.isArray(ltr)) {
+ return false;
+ }
+ const expected = [-ltr[0], ltr[1], -ltr[2], ltr[3]];
+ return expected.every((value, index) => Math.abs(value - rtl[index]) < 0.01);
+}
+
+/** Classify one stable LTR/RTL contextual-decoration pair. */
+export function classifyDirectionalDecorationPair(ltr, rtl) {
+ if (!ltr || !rtl) {
+ return {verdict: 'fail', reason: 'decoration is missing in one direction'};
+ }
+
+ const mirrored = isMirrorOf(rtl.matrix, ltr.matrix);
+ const sameMatrix = matricesEqual(ltr.matrix, rtl.matrix);
+ const swapped = EXPLICIT_GLYPH_PAIRS.get(ltr.glyph) === rtl.glyph;
+
+ if (ltr.policy === 'auto-bidi') {
+ if (ltr.glyph !== rtl.glyph) {
+ return {
+ verdict: 'fail',
+ reason:
+ 'Unicode-mirrored glyph was swapped in the DOM (double handling)',
+ };
+ }
+ if (mirrored) {
+ return {
+ verdict: 'fail',
+ reason:
+ 'Unicode-mirrored glyph also has an RTL transform (double handling)',
+ };
+ }
+ if (!sameMatrix) {
+ return {
+ verdict: 'fail',
+ reason:
+ 'Unicode-mirrored glyph has an unexpected direction-only transform',
+ };
+ }
+ return {
+ verdict: 'pass',
+ reason: 'Unicode bidi mirroring handles the unchanged glyph',
+ };
+ }
+
+ if (mirrored && swapped) {
+ return {
+ verdict: 'fail',
+ reason: 'glyph is both swapped and transformed (double handling)',
+ };
+ }
+ if (mirrored) {
+ return {
+ verdict: 'pass',
+ reason: 'decoration mirrors through its transform',
+ };
+ }
+ if (swapped && sameMatrix) {
+ return {verdict: 'pass', reason: 'decoration swaps to its opposite glyph'};
+ }
+ return {
+ verdict: 'fail',
+ reason: 'contextual directional decoration neither mirrors nor swaps',
+ };
+}
+
+/** Roll up all contextual decorations found in one story. */
+export function evaluateDirectionalDecorations(ltr, rtl) {
+ if (ltr.length === 0 && rtl.length === 0) {
+ return {
+ verdict: 'N-A',
+ results: [],
+ notes: ['no contextual directional decorations'],
+ };
+ }
+
+ const count = Math.max(ltr.length, rtl.length);
+ const results = [];
+ for (let index = 0; index < count; index += 1) {
+ const result = classifyDirectionalDecorationPair(ltr[index], rtl[index]);
+ results.push({
+ index,
+ glyph: ltr[index]?.glyph ?? rtl[index]?.glyph,
+ ...result,
+ });
+ }
+ const failures = results.filter(result => result.verdict === 'fail');
+ return {
+ verdict: failures.length > 0 ? 'fail' : 'pass',
+ results,
+ notes:
+ failures.length > 0
+ ? failures.map(failure => `${failure.glyph ?? '?'}: ${failure.reason}`)
+ : ['every contextual directional decoration mirrors exactly once'],
+ };
+}
+
+function resultIsApplicable(result) {
+ return result?.verdict === 'pass' || result?.verdict === 'fail';
+}
+
+/**
+ * Classify every component in the audited roster. An unexplained all-N/A result
+ * is a coverage gap; a verified-N/A declaration is stale if a detector later
+ * finds applicable behavior.
+ */
+export function buildComponentCoverage({
+ components,
+ autoResults = [],
+ positionalResults = [],
+ decorationResults = [],
+ curatedResults = [],
+ verifiedNa = [],
+ enforced = true,
+}) {
+ const byName = new Map();
+ for (const component of components) {
+ const key = component.toLowerCase();
+ if (!byName.has(key)) {
+ byName.set(key, {component, applicable: []});
+ }
+ }
+
+ const addApplicable = (result, dimension, isApplicable) => {
+ if (!isApplicable) {
+ return;
+ }
+ const key = result.component.toLowerCase();
+ const entry = byName.get(key) ?? {
+ component: result.component,
+ applicable: [],
+ };
+ entry.applicable.push({dimension, storyId: result.storyId});
+ byName.set(key, entry);
+ };
+
+ for (const result of autoResults) {
+ addApplicable(result, 'D1', resultIsApplicable(result));
+ }
+ for (const result of positionalResults) {
+ addApplicable(result, 'D5', resultIsApplicable(result));
+ }
+ for (const result of decorationResults) {
+ addApplicable(result, 'D6', resultIsApplicable(result));
+ }
+ for (const result of curatedResults) {
+ addApplicable(
+ result,
+ 'curated',
+ ['RTL-ready', 'not-RTL', 'partial'].includes(result.rollup),
+ );
+ }
+
+ const verified = new Map();
+ for (const declaration of verifiedNa) {
+ if (declaration?.component && declaration?.reason?.trim()) {
+ verified.set(
+ declaration.component.toLowerCase(),
+ declaration.reason.trim(),
+ );
+ }
+ }
+
+ const results = Array.from(byName.values())
+ .sort((left, right) => left.component.localeCompare(right.component))
+ .map(entry => {
+ const reason = verified.get(entry.component.toLowerCase());
+ if (entry.applicable.length > 0 && reason) {
+ return {
+ ...entry,
+ status: 'stale-verified-na',
+ reason,
+ note: 'verified-N/A declaration conflicts with applicable RTL behavior',
+ };
+ }
+ if (entry.applicable.length > 0) {
+ return {...entry, status: 'measured'};
+ }
+ if (reason) {
+ return {...entry, status: 'verified-na', reason};
+ }
+ return {
+ ...entry,
+ status: 'coverage-gap',
+ note: 'all dimensions are N-A and no verified-N/A reason is recorded',
+ };
+ });
+
+ const count = status =>
+ results.filter(result => result.status === status).length;
+ return {
+ enforced,
+ total: results.length,
+ measured: count('measured'),
+ verifiedNa: count('verified-na'),
+ gaps: count('coverage-gap'),
+ staleVerifiedNa: count('stale-verified-na'),
+ results,
+ };
+}
diff --git a/apps/storybook/rtl-audit/rtl-audit.mjs b/apps/storybook/rtl-audit/rtl-audit.mjs
index c06203c1c5..4e4a4a78aa 100644
--- a/apps/storybook/rtl-audit/rtl-audit.mjs
+++ b/apps/storybook/rtl-audit/rtl-audit.mjs
@@ -8,21 +8,27 @@
* (relationship-based, no golden screenshots). Two layers:
* (A) AUTO-DISCOVERY — runs over EVERY `core-*` and `lab-*` story with zero
* curated selectors, so a NEW component that ships without RTL handling
- * is caught automatically. Two auto passes:
- * - D1 (icon-mirror): directional glyphs must flip/swap under RTL.
+ * is caught automatically. Three auto passes:
+ * - D1 (icon-mirror): directional SVG icons must flip/swap under RTL.
* - D5 (positional-mirror): an absolutely/fixed-positioned element
* with a LOGICAL anchor (insetInlineStart/End) + an UNFLIPPED
* PHYSICAL transform (translate/translateX) lands on the WRONG SIDE
* in RTL. Lint can't see this — each prop is individually fine; the
* bug is their interaction at layout time. We assert each candidate's
* RTL center mirrors its LTR center about the offsetParent center.
+ * - D6 (directional-decoration): single-glyph, aria-hidden decorations
+ * in repeated-item or between-sibling contexts mirror exactly once.
* (B) CURATED PRECISION — targets.json entries add D2 (order-flip),
* D3 (behavior-flip), D4 (overlay-side): the geometry/behavior dims that
* genuinely need hand-written selectors.
- * @input --storybook-dir <path> --output <file> [--targets <path>] [--filter <csv>]
- * [--auto-only] [--curated-only]
- * @output JSON scorecard: auto-discovery D1 verdicts across all audited stories
- * + curated D2/D3/D4 results. Mirrors the pr-a11y accessibility-audit harness.
+ * (C) APPLICABILITY: every component is measured, explicitly verified N/A,
+ * or reported as a coverage gap. An all-N/A result is never called clean.
+ * @input --storybook-dir <path> --output <file> [--targets <path>]
+ * [--verified-not-applicable <path>] [--filter <csv>] [--auto-only]
+ * [--curated-only]
+ * @output JSON scorecard: D1/D5/D6 auto verdicts, curated D2/D3/D4 results,
+ * and a component coverage rollup. Mirrors the pr-a11y accessibility-audit
+ * harness.
* @position internal test harness; run by the soft-gated `pr-rtl` CI job and
* locally via `pnpm -F @astryxdesign/storybook rtl-audit`.
*
@@ -40,6 +46,12 @@ import http from 'node:http';
import fs from 'node:fs';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
+import {discoverComponents} from '../../../packages/cli/foundation/discovery/component-discovery.mjs';
+import {
+ buildComponentCoverage,
+ collectDirectionalDecorations,
+ evaluateDirectionalDecorations,
+} from './rtl-audit-coverage.mjs';
const args = process.argv.slice(2);
const getArg = name => {
@@ -48,9 +60,13 @@ const getArg = name => {
};
const hasFlag = name => args.includes(`--${name}`);
const HERE = path.dirname(fileURLToPath(import.meta.url));
+const PROJECT_ROOT = path.resolve(HERE, '../../..');
const DIST = getArg('storybook-dir') || 'apps/storybook/dist';
const OUT = getArg('output') || 'rtl-audit-report.json';
const TARGETS_PATH = getArg('targets') || path.join(HERE, 'targets.json');
+const VERIFIED_NA_PATH =
+ getArg('verified-not-applicable') ||
+ path.join(HERE, 'verified-not-applicable.json');
const FILTER = (getArg('filter') || '').split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
const AUTO_ONLY = hasFlag('auto-only');
const CURATED_ONLY = hasFlag('curated-only');
@@ -353,6 +369,38 @@ async function detectDirectionalIcons(page) {
return page.evaluate(DETECTOR).catch(() => []);
}
+async function detectDirectionalDecorations(page) {
+ return page.evaluate(collectDirectionalDecorations).catch(() => []);
+}
+
+// Auto-discovery D6 runs every story because contextual separators often live
+// outside a component's default story. The LTR-first short-circuit avoids the
+// RTL navigation for the common case with no candidate.
+async function autoDirectionalDecorations(page, port, storyId, component) {
+ const card = {component, storyId, dim: 'D6-decoration', verdict: 'N-A', notes: [], decorations: 0, results: []};
+ await page.goto(storyUrl(port, storyId, false), {waitUntil: 'domcontentloaded'});
+ await settle(page);
+ const revealedL = await revealInteractionGated(page);
+ const ltr = await detectDirectionalDecorations(page);
+ if (ltr.length === 0) {
+ if (revealedL) card.notes.push('opened an interaction-gated surface before scanning');
+ card.notes.push('no contextual directional decorations');
+ return card;
+ }
+
+ await page.goto(storyUrl(port, storyId, true), {waitUntil: 'domcontentloaded'});
+ await settle(page);
+ const revealedR = await revealInteractionGated(page);
+ const rtl = await detectDirectionalDecorations(page);
+ const evaluated = evaluateDirectionalDecorations(ltr, rtl);
+ card.verdict = evaluated.verdict;
+ card.notes.push(...evaluated.notes);
+ card.results = evaluated.results;
+ card.decorations = Math.max(ltr.length, rtl.length);
+ if (revealedL || revealedR) card.notes.unshift('opened an interaction-gated surface before scanning');
+ return card;
+}
+
// ===========================================================================
// AUTO-DISCOVERY: D5 positional-mirror
// ===========================================================================
@@ -676,10 +724,16 @@ async function scoreCurated(page, port, t) {
// ---------------------------------------------------------------------------
function componentFromId(id) {
- // core-tabletree--default -> TableTree (best-effort display name)
- // lab-listinput--tag-options -> listinput
+ // core-tabletree--default -> core/tabletree (best-effort display name)
+ // lab-listinput--tag-options -> lab/listinput
+ const packageName = id.startsWith('lab-') ? 'lab' : 'core';
const seg = id.replace(AUDITED_STORY_PREFIX, '').split('--')[0];
- return seg;
+ return `${packageName}/${seg}`;
+}
+
+function matchesFilter(component) {
+ const name = component.split('/').at(-1)?.toLowerCase() ?? component;
+ return !FILTER.length || FILTER.includes(name);
}
// Run `fn` over `items` with `pages.length` workers, each pinned to its own
@@ -717,16 +771,42 @@ async function mapPool(items, pages, fn) {
process.exit(2);
}
+ const storyIds = Object.keys(entries).filter(
+ id =>
+ entries[id].type === 'story' &&
+ AUDITED_STORY_PREFIX.test(id) &&
+ !/--docs$/.test(id),
+ );
+ const sourceComponents = [];
+ for (const packageName of ['core', 'lab']) {
+ try {
+ const grouped = discoverComponents(path.join(PROJECT_ROOT, 'packages', packageName));
+ sourceComponents.push(
+ ...Object.values(grouped)
+ .flat()
+ .map(component => `${packageName}/${component}`),
+ );
+ } catch (error) {
+ console.error(`WARN: cannot discover ${packageName} component roster: ${String(error).slice(0, 120)}`);
+ }
+ }
+ const unmatchedFilters = FILTER.filter(
+ filter =>
+ !sourceComponents.some(
+ component => component.split('/').at(-1)?.toLowerCase() === filter,
+ ),
+ ).map(filter => `unknown/${filter}`);
+ const auditedComponents = Array.from(
+ new Map(
+ [...sourceComponents, ...storyIds.map(componentFromId), ...unmatchedFilters].map(component => [component.toLowerCase(), component]),
+ ).values(),
+ ).filter(matchesFilter);
+
// ---- (A) auto-discovery over every audited-package story ----
const autoResults = []; // D1 icon-mirror
const pmResults = []; // D5 positional-mirror
+ const decorationResults = []; // D6 contextual directional decoration
if (!CURATED_ONLY) {
- const storyIds = Object.keys(entries).filter(
- id =>
- entries[id].type === 'story' &&
- AUDITED_STORY_PREFIX.test(id) &&
- !/--docs$/.test(id),
- );
// D1 runs one representative story per component (extra stories add little
// D1 signal). D5 (positional-mirror) runs over EVERY core story — a
// positioned bug can be story-specific (only a `withStatus` variant mounts
@@ -737,7 +817,7 @@ async function mapPool(items, pages, fn) {
if (!perComponent.has(comp)) perComponent.set(comp, id);
}
const d1Targets = [...perComponent]
- .filter(([comp]) => !FILTER.length || FILTER.includes(comp.toLowerCase()))
+ .filter(([comp]) => matchesFilter(comp))
.map(([comp, id]) => ({comp, id}));
autoResults.push(
...(await mapPool(d1Targets, pages, async ({comp, id}, workerPage) => {
@@ -756,7 +836,7 @@ async function mapPool(items, pages, fn) {
// D5 positional-mirror over every audited story.
const pmTargets = storyIds
.map(id => ({id, comp: componentFromId(id)}))
- .filter(({comp}) => !FILTER.length || FILTER.includes(comp.toLowerCase()));
+ .filter(({comp}) => matchesFilter(comp));
pmResults.push(
...(await mapPool(pmTargets, pages, async ({id, comp}, workerPage) => {
try {
@@ -771,6 +851,22 @@ async function mapPool(items, pages, fn) {
}
})),
);
+ // D6 scans every story. A directional decoration can exist only in a
+ // custom/variant story even when the default story is neutral.
+ decorationResults.push(
+ ...(await mapPool(pmTargets, pages, async ({id, comp}, workerPage) => {
+ try {
+ const card = await autoDirectionalDecorations(workerPage, port, id, comp);
+ if (card.verdict !== 'N-A') {
+ console.error(`DEC ${card.verdict.toUpperCase().padEnd(4)} ${comp.padEnd(24)} ${id.padEnd(40)} glyphs=${card.decorations}`);
+ }
+ return card;
+ } catch (e) {
+ console.error(`DEC ERROR ${comp} ${id}: ${String(e).slice(0, 120)}`);
+ return {component: comp, storyId: id, dim: 'D6-decoration', verdict: 'ERROR', notes: [String(e).slice(0, 160)], decorations: 0, results: []};
+ }
+ })),
+ );
}
// ---- (B) curated precision dims ----
@@ -782,24 +878,48 @@ async function mapPool(items, pages, fn) {
let targets = [];
try { targets = JSON.parse(fs.readFileSync(TARGETS_PATH, 'utf8')); } catch {}
for (const t of targets) {
- if (FILTER.length && !FILTER.includes(t.component.toLowerCase())) continue;
+ const component = componentFromId(t.storyId);
+ if (!matchesFilter(component)) continue;
if (!entries[t.storyId]) {
- curatedResults.push({component: t.component, storyId: t.storyId, rollup: 'MISSING-STORY', dims: {}, notes: ['story not in index.json']});
+ curatedResults.push({component, storyId: t.storyId, rollup: 'MISSING-STORY', dims: {}, notes: ['story not in index.json']});
continue;
}
// skip if the entry only had D1 (now covered by auto-discovery)
const dims = (t.dims || []).filter(d => d !== 'D1');
if (dims.length === 0) continue;
try {
- const card = await scoreCurated(page, port, {...t, dims});
+ const card = await scoreCurated(page, port, {...t, component, dims});
curatedResults.push(card);
- console.error(`CUR ${card.rollup.padEnd(10)} ${t.component.padEnd(20)} ${JSON.stringify(card.dims)}`);
+ console.error(`CUR ${card.rollup.padEnd(10)} ${component.padEnd(20)} ${JSON.stringify(card.dims)}`);
} catch (e) {
- curatedResults.push({component: t.component, storyId: t.storyId, rollup: 'ERROR', dims: {}, notes: [String(e).slice(0, 200)]});
+ curatedResults.push({component, storyId: t.storyId, rollup: 'ERROR', dims: {}, notes: [String(e).slice(0, 200)]});
}
}
}
+ let verifiedNa = [];
+ let verifiedNaError = null;
+ try {
+ const parsed = JSON.parse(fs.readFileSync(VERIFIED_NA_PATH, 'utf8'));
+ if (!Array.isArray(parsed)) throw new Error('verified-not-applicable registry must be a JSON array');
+ verifiedNa = parsed;
+ } catch (error) {
+ verifiedNaError = String(error).slice(0, 200);
+ }
+
+ const coverage = buildComponentCoverage({
+ components: auditedComponents,
+ autoResults,
+ positionalResults: pmResults,
+ decorationResults,
+ curatedResults,
+ verifiedNa,
+ // Partial modes intentionally omit dimensions, so they report but do not
+ // enforce applicability gaps.
+ enforced: !AUTO_ONLY && !CURATED_ONLY,
+ });
+ if (verifiedNaError) coverage.registryError = verifiedNaError;
+
await Promise.all(pages.map(p => p.close().catch(() => {})));
await browser.close();
server.close();
@@ -809,6 +929,7 @@ async function mapPool(items, pages, fn) {
// complete, so any directional icon that fails to mirror is a real regression.
const surprises = autoFails;
const pmFails = pmResults.filter(r => r.verdict === 'fail' || r.verdict === 'ERROR');
+ const decorationFails = decorationResults.filter(r => r.verdict === 'fail' || r.verdict === 'ERROR');
const report = {
generatedAt: new Date().toISOString(),
dist: DIST,
@@ -831,17 +952,30 @@ async function mapPool(items, pages, fn) {
// fails carry per-element cls + LTR/RTL relCenterX + delta (actionable).
results: pmResults,
},
+ directionalDecorations: {
+ total: decorationResults.length,
+ applicable: decorationResults.filter(r => r.verdict !== 'N-A').length,
+ pass: decorationResults.filter(r => r.verdict === 'pass').length,
+ fail: decorationFails.length,
+ na: decorationResults.filter(r => r.verdict === 'N-A').length,
+ results: decorationResults,
+ },
curated: {results: curatedResults},
+ coverage,
};
fs.writeFileSync(OUT, JSON.stringify(report, null, 2));
console.error(`\nWROTE ${OUT}`);
console.error(`AUTO: ${report.autoDiscovery.pass} pass / ${report.autoDiscovery.fail} fail (${surprises.length} surprise) / ${report.autoDiscovery.na} N-A`);
console.error(`PM : ${report.positionalMirror.pass} pass / ${report.positionalMirror.fail} fail / ${report.positionalMirror.na} N-A (tol ${PM_TOL}px)`);
+ console.error(`DEC : ${report.directionalDecorations.pass} pass / ${report.directionalDecorations.fail} fail / ${report.directionalDecorations.na} N-A`);
+ console.error(`COV : ${coverage.measured} measured / ${coverage.verifiedNa} verified N-A / ${coverage.gaps} gap / ${coverage.staleVerifiedNa} stale`);
// Non-zero exit only signals CI (which is soft/continue-on-error). Surface a
// signal but never let it hard-block during the stability window.
const anySignal =
autoFails.length > 0 ||
pmFails.length > 0 ||
+ decorationFails.length > 0 ||
+ (coverage.enforced && (coverage.gaps > 0 || coverage.staleVerifiedNa > 0 || coverage.registryError != null)) ||
curatedResults.some(r => r.rollup === 'not-RTL' || r.rollup === 'ERROR' || r.rollup === 'MISSING-STORY');
process.exit(anySignal ? 1 : 0);
})();
diff --git a/apps/storybook/rtl-audit/verified-not-applicable.json b/apps/storybook/rtl-audit/verified-not-applicable.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/apps/storybook/rtl-audit/verified-not-applicable.json
@@ -0,0 +1 @@
+[]
diff --git a/apps/storybook/stories/Breadcrumbs.stories.tsx b/apps/storybook/stories/Breadcrumbs.stories.tsx
index c0f69eaba9..1e353b78d7 100644
--- a/apps/storybook/stories/Breadcrumbs.stories.tsx
+++ b/apps/storybook/stories/Breadcrumbs.stories.tsx
@@ -1,6 +1,7 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
import type {Meta, StoryObj} from '@storybook/react';
+import * as stylex from '@stylexjs/stylex';
import {
Breadcrumbs,
BreadcrumbItem,
@@ -8,6 +9,7 @@ import {
} from '@astryxdesign/core/Breadcrumbs';
import type {BreadcrumbMenuOption} from '@astryxdesign/core/Breadcrumbs';
import {Icon} from '@astryxdesign/core/Icon';
+import {VStack} from '@astryxdesign/core/Layout';
import {rtlStyles} from '@astryxdesign/core/utils';
import {HomeIcon, Cog6ToothIcon, FolderIcon} from '@heroicons/react/24/outline';
@@ -65,15 +67,27 @@ export const AutoDetectCurrent: Story = {
),
};
+/**
+ * Covers both separator strategies D6 distinguishes: automatic Unicode bidi
+ * mirroring and one explicit mirror for a directional glyph.
+ */
export const CustomSeparator: Story = {
+ tags: ['visual-baseline'],
render: () => (
- // No rtlStyles.mirror here: U+203A has Unicode Bidi_Mirrored=Yes, so the
- // browser flips it under RTL already and an explicit mirror would undo that.
- <Breadcrumbs separator={'›'}>
- <BreadcrumbItem href="/">Home</BreadcrumbItem>
- <BreadcrumbItem href="/docs">Docs</BreadcrumbItem>
- <BreadcrumbItem isCurrent>API Reference</BreadcrumbItem>
- </Breadcrumbs>
+ <VStack gap={3}>
+ <Breadcrumbs label="Automatic bidi separator" separator={'›'}>
+ <BreadcrumbItem href="/">Home</BreadcrumbItem>
+ <BreadcrumbItem href="/docs">Docs</BreadcrumbItem>
+ <BreadcrumbItem isCurrent>API Reference</BreadcrumbItem>
+ </Breadcrumbs>
+ <Breadcrumbs
+ label="Explicitly mirrored separator"
+ separator={<span {...stylex.props(rtlStyles.mirror)}>→</span>}>
+ <BreadcrumbItem href="/">Home</BreadcrumbItem>
+ <BreadcrumbItem href="/docs">Docs</BreadcrumbItem>
+ <BreadcrumbItem isCurrent>API Reference</BreadcrumbItem>
+ </Breadcrumbs>
+ </VStack>
),
};
diff --git a/packages/core/src/Breadcrumbs/BreadcrumbItem.tsx b/packages/core/src/Breadcrumbs/BreadcrumbItem.tsx
index d7fe27dcdc..f5fc371cc4 100644
--- a/packages/core/src/Breadcrumbs/BreadcrumbItem.tsx
+++ b/packages/core/src/Breadcrumbs/BreadcrumbItem.tsx
@@ -5,8 +5,9 @@
/**
* @file BreadcrumbItem.tsx
* @input Uses React use/useRef/useEffect, stylex, theme tokens, BreadcrumbContext,
- * and (for the menu trigger) usePopover + the shared DropdownMenu item API
- * (renderDropdownItems, DropdownMenuContext, MENU_ITEM_SELECTOR, useListFocus)
+ * rtlStyles for the contextual default slash, and (for the menu trigger)
+ * usePopover + the shared DropdownMenu item API (renderDropdownItems,
+ * DropdownMenuContext, MENU_ITEM_SELECTOR, useListFocus)
* @output Exports BreadcrumbItem component and BreadcrumbItemProps
* @position Individual breadcrumb item; used inside Breadcrumbs
*
@@ -43,7 +44,7 @@ import {
import {BreadcrumbContext, type BreadcrumbsVariant} from './Breadcrumbs';
import {useLinkComponent} from '../Link/useLinkComponent';
import type {LinkComponentType} from '../Link/types';
-import {mergeProps} from '../utils';
+import {mergeProps, rtlStyles} from '../utils';
import type {BaseProps} from '../BaseProps';
import {themeProps} from '../utils/themeProps';
import {focusOutlineProps} from '../utils/focusOutline.stylex';
@@ -221,6 +222,18 @@ const itemStyles = stylex.create({
},
});
+function BreadcrumbSeparator({separator}: {separator: ReactNode}) {
+ return (
+ <span aria-hidden="true" {...stylex.props(itemStyles.separator)}>
+ {separator === '/' ? (
+ <span {...stylex.props(rtlStyles.mirror)}>/</span>
+ ) : (
+ separator
+ )}
+ </span>
+ );
+}
+
const menuStyles = stylex.create({
menu: {
boxSizing: 'border-box',
@@ -373,9 +386,7 @@ export function BreadcrumbItem({
)}
data-testid={testId}
{...rest}>
- <span aria-hidden="true" {...stylex.props(itemStyles.separator)}>
- {ctx.separator}
- </span>
+ <BreadcrumbSeparator separator={ctx.separator} />
{hasMenu ? (
// A current crumb can also open a sibling menu — the trigger keeps
// both aria-current="page" and aria-haspopup="menu".
@@ -422,9 +433,7 @@ export function BreadcrumbItem({
)}
data-testid={testId}
{...rest}>
- <span aria-hidden="true" {...stylex.props(itemStyles.separator)}>
- {ctx.separator}
- </span>
+ <BreadcrumbSeparator separator={ctx.separator} />
{hasMenu ? (
<BreadcrumbMenuTrigger
ref={contentRef}
diff --git a/packages/core/src/Breadcrumbs/Breadcrumbs.doc.mjs b/packages/core/src/Breadcrumbs/Breadcrumbs.doc.mjs
index ab6d1bf345..cd21eca25e 100644
--- a/packages/core/src/Breadcrumbs/Breadcrumbs.doc.mjs
+++ b/packages/core/src/Breadcrumbs/Breadcrumbs.doc.mjs
@@ -21,6 +21,7 @@ export const docs = {
{guidance: false, description: 'Use breadcrumbs as the primary navigation. They supplement a sidebar or top nav, not replace it.'},
{guidance: false, description: 'Show breadcrumbs on top-level pages that have no parent; they add clutter without helping the user.'},
{guidance: false, description: 'Let the trail grow beyond 5 levels. If you need more, consider simplifying the page hierarchy instead.'},
+ {guidance: true, description: 'The built-in slash separator mirrors automatically in RTL. For a custom separator, leave Unicode-mirrored angle quotes such as › alone; mirror arrows and Icon separators once with rtlStyles.mirror.'},
{guidance: false, description: 'Mirror a separator the bidi algorithm already mirrors. An angle-quote glyph such as › is Bidi_Mirrored, so it flips under RTL on its own and rtlStyles.mirror would flip it back. An arrow glyph such as → and any Icon separator are not, so those do need rtlStyles.mirror through xstyle.'},
],
anatomy: [
@@ -61,7 +62,7 @@ export const docs = {
{
name: 'separator',
type: 'ReactNode',
- description: 'Separator rendered between breadcrumb items.',
+ description: 'Separator rendered between breadcrumb items. The built-in slash mirrors automatically in RTL.',
default: "'/'",
slotElements: [
{
@@ -161,6 +162,7 @@ export const docsZh = {
{guidance: false, description: 'Use breadcrumbs as the primary navigation. They supplement a sidebar or top nav, not replace it.'},
{guidance: false, description: 'Show breadcrumbs on top-level pages that have no parent; they add clutter without helping the user.'},
{guidance: false, description: 'Let the trail grow beyond 5 levels. If you need more, consider simplifying the page hierarchy instead.'},
+ {guidance: true, description: 'The built-in slash separator mirrors automatically in RTL. For a custom separator, leave Unicode-mirrored angle quotes such as › alone; mirror arrows and Icon separators once with rtlStyles.mirror.'},
{guidance: false, description: 'Mirror a separator the bidi algorithm already mirrors. An angle-quote glyph such as › is Bidi_Mirrored, so it flips under RTL on its own and rtlStyles.mirror would flip it back. An arrow glyph such as → and any Icon separator are not, so those do need rtlStyles.mirror through xstyle.'},
],
},
@@ -182,6 +184,7 @@ export const docsDense = {
{guidance: false, description: 'Use as primary navigation; breadcrumbs supplement, not replace, a main nav.'},
{guidance: false, description: 'Show on top-level pages with no parent.'},
{guidance: false, description: 'Let the trail exceed 5 levels; simplify the hierarchy instead.'},
+ {guidance: true, description: 'Built-in / mirrors automatically in RTL. Leave bidi-mirrored › alone; mirror custom arrows and Icons once.'},
{guidance: false, description: 'Mirror a separator that already mirrors itself: › is Bidi_Mirrored and flips under RTL on its own. → and Icon separators are not, so those need rtlStyles.mirror via xstyle.'},
],
},
diff --git a/packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx b/packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx
index 5d219cdbd9..d37c87191e 100644
--- a/packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx
+++ b/packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx
@@ -74,6 +74,18 @@ describe('Breadcrumbs', () => {
expect(separators[0].textContent).toBe('/');
});
+ it('wraps the contextual default slash in the RTL mirror style', () => {
+ const {container} = render(
+ <Breadcrumbs>
+ <BreadcrumbItem href="/">Home</BreadcrumbItem>
+ <BreadcrumbItem isCurrent>Page</BreadcrumbItem>
+ </Breadcrumbs>,
+ );
+ const separators = container.querySelectorAll('span[aria-hidden="true"]');
+ expect(separators[1].firstElementChild).toHaveTextContent('/');
+ expect(separators[1].firstElementChild).toHaveAttribute('class');
+ });
+
it('supports custom separator', () => {
const {container} = render(
<Breadcrumbs separator={<span>›</span>}>