Skip to content

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

TypeScript

test(rtl): RTL coverage for six TopNav parts (FeaturedCard bug left visible) (#9313)

Cindy Zhangb793e5d1bd85
diff --git a/apps/storybook/rtl-audit/targets.json b/apps/storybook/rtl-audit/targets.json
index 9175404398..d2d102d70a 100644
--- a/apps/storybook/rtl-audit/targets.json
+++ b/apps/storybook/rtl-audit/targets.json
@@ -17,6 +17,69 @@
"next": "[data-testid=\"button-label\"]"
}
},
+ {
+ "component": "TopNav",
+ "storyId": "core-topnav--full-example",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-top-nav-heading",
+ "next": ".astryx-top-nav-item"
+ }
+ },
+ {
+ "component": "TopNavHeading",
+ "storyId": "core-topnav--full-example",
+ "dims": ["D2", "D8"],
+ "selectors": {
+ "prev": ".astryx-top-nav-heading > :first-child",
+ "next": ".astryx-top-nav-heading > :last-child",
+ "subject": ".astryx-top-nav-heading"
+ }
+ },
+ {
+ "component": "TopNavItem",
+ "storyId": "core-topnav--full-example",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-top-nav-item:has-text(\"Dashboard\") > svg",
+ "next": ".astryx-top-nav-item:has-text(\"Dashboard\")"
+ }
+ },
+ {
+ "component": "TopNavMenu",
+ "storyId": "core-topnavmenu--default",
+ "dims": ["D4"],
+ "setup": {"click": "button.astryx-top-nav-menu"},
+ "selectors": {
+ "overlay": ".astryx-popover",
+ "overlayRoot": "body"
+ }
+ },
+ {
+ "component": "TopNavMegaMenu",
+ "storyId": "core-topnavmenu--mega-menu",
+ "dims": ["D4"],
+ "setup": {"click": "button.astryx-top-nav-mega-menu"},
+ "selectors": {
+ "overlay": ".astryx-popover",
+ "overlayRoot": "body"
+ }
+ },
+ {
+ "component": "TopNavMegaMenuItem",
+ "storyId": "core-topnavmenu--mega-menu",
+ "dims": ["D2"],
+ "setup": {"click": "button.astryx-top-nav-mega-menu"},
+ "selectors": {
+ "prev": ".astryx-top-nav-mega-menu-item > :first-child",
+ "next": ".astryx-top-nav-mega-menu-item > :last-child"
+ }
+ },
+ {
+ "component": "TopNavMenu",
+ "storyId": "core-topnavmenu--mega-menu",
+ "dims": []
+ },
{
"component": "ButtonGroup",
"storyId": "core-buttongroup--horizontal",
diff --git a/docs/specs/components/TopNav/TopNav.spec.md b/docs/specs/components/TopNav/TopNav.spec.md
index 84b2ca4fab..6a2771c9b7 100644
--- a/docs/specs/components/TopNav/TopNav.spec.md
+++ b/docs/specs/components/TopNav/TopNav.spec.md
@@ -16,6 +16,7 @@ verified_by:
packages/core/src/TopNav/__tests__/TopNavMobileLongHeading.a11y.chromium.spec.ts,
packages/core/src/AppShell/AppShell.test.tsx,
apps/storybook/stories/TopNav.stories.tsx,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families: []
@@ -167,12 +168,13 @@ component's record names its own target.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ------------ | ----------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------- | ---------------------------- |
-| FR1, AR1 | `TopNav.test.tsx` landmark tests | Default and mobile-bar; default and custom name | A missing role or name fails. | `audit:TopNav/accessibility` |
-| FR2–FR4, FR8 | `TopNav.test.tsx` slot tests | Each slot; all slots; center without start/end | A dropped slot, wrong precedence, or positioned nav fails. | `audit:TopNav/layout` |
-| FR5, FR6 | `AppShell.test.tsx` mobile suites | Heading-only; items; items with side nav | A missing toggle or duplicated items fails. | `audit:TopNav/behavior` |
-| AR2 | `TopNavMobileLongHeading.a11y.chromium.spec.ts` | Long heading at phone width | The toggle or close button leaves the viewport. | `audit:TopNav/accessibility` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------ | ------------------------------------------------------------------------------------------------ | ----------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------- |
+| FR1, AR1 | `TopNav.test.tsx` landmark tests | Default and mobile-bar; default and custom name | A missing role or name fails. | `audit:TopNav/accessibility` |
+| FR2–FR4, FR8 | `TopNav.test.tsx` slot tests | Each slot; all slots; center without start/end | A dropped slot, wrong precedence, or positioned nav fails. | `audit:TopNav/layout` |
+| FR5, FR6 | `AppShell.test.tsx` mobile suites | Heading-only; items; items with side nav | A missing toggle or duplicated items fails. | `audit:TopNav/behavior` |
+| AR2 | `TopNavMobileLongHeading.a11y.chromium.spec.ts` | Long heading at phone width | The toggle or close button leaves the viewport. | `audit:TopNav/accessibility` |
+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `TopNav / Full example` | Heading and first navigation item; LTR and RTL | A heading that is not at the inline start of the navigation items fails D2. | `audit:TopNav/i18n-rtl` |
Read from source, with no focused test yet: the mobile bar's part order (FR5); the drawer's `heading` header (FR6); other DOM props reaching the `<nav>` (FR1); the auto-toggle condition (FR5); rendering nothing in `drawer` mode with no content (FR6); the `top-nav` target and its `mode` state (FR1); the flex and grid layout geometry (FR3, FR4); that start and center content do not render in the mobile bar (FR5); the drawer's content order and divider (FR6); FR7; and FR9.
diff --git a/docs/specs/components/TopNav/TopNavHeading.spec.md b/docs/specs/components/TopNav/TopNavHeading.spec.md
index 6cfc5d14b2..94ee3921fd 100644
--- a/docs/specs/components/TopNav/TopNavHeading.spec.md
+++ b/docs/specs/components/TopNav/TopNavHeading.spec.md
@@ -14,6 +14,7 @@ verified_by:
[
packages/core/src/TopNav/TopNav.test.tsx,
apps/storybook/stories/TopNav.stories.tsx,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families:
@@ -188,12 +189,13 @@ is recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ----------------- | --------------------------------------------------------------------------- | ------------------------------------- | --------------------------------------------- | ----------------------------------- |
-| FR1–FR3, AR1 | `TopNav.test.tsx` TopNavHeading render and logo-name tests | Each configuration | A wrong element or unnamed logo link fails. | `audit:TopNavHeading/behavior` |
-| FR4, FR7, AR2–AR3 | `TopNav.test.tsx` menu popover semantics tests | Whole trigger; links plus trigger | A modal wrapper or misplaced menu role fails. | `audit:TopNavHeading/accessibility` |
-| FR5, FR8 | `TopNav.test.tsx` hover/click guard tests | Hover-open, click, late click, Escape | Losing the guard or focus return fails. | `audit:TopNavHeading/behavior` |
-| FR10 | `TopNav.test.tsx` TopNavHeading menu-popover suite (touch and mouse slides) | Touch and mouse slides across items | Removing the adoption fails the slide tests. | — |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ----------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
+| FR1–FR3, AR1 | `TopNav.test.tsx` TopNavHeading render and logo-name tests | Each configuration | A wrong element or unnamed logo link fails. | `audit:TopNavHeading/behavior` |
+| FR4, FR7, AR2–AR3 | `TopNav.test.tsx` menu popover semantics tests | Whole trigger; links plus trigger | A modal wrapper or misplaced menu role fails. | `audit:TopNavHeading/accessibility` |
+| FR5, FR8 | `TopNav.test.tsx` hover/click guard tests | Hover-open, click, late click, Escape | Losing the guard or focus return fails. | `audit:TopNavHeading/behavior` |
+| FR10 | `TopNav.test.tsx` TopNavHeading menu-popover suite (touch and mouse slides) | Touch and mouse slides across items | Removing the adoption fails the slide tests. | — |
+| RTL relation | RTL audit curated D2 and D8 target (`apps/storybook/rtl-audit/targets.json`) on `TopNav / Full example` | Heading logo and title, with 0px start and 8px end padding; LTR and RTL | A logo that is not at the inline start of the title, or an end padding that stays on the same physical side in RTL, fails D2 or D8. | `audit:TopNavHeading/i18n-rtl` |
Read from source, with no focused test yet: that clicking the block itself opens the menu in the menu-without-hrefs configuration (FR2); the `dialogLabel` fallback name of the menu (FR7); that the rest of the block opens the menu in the links-plus-trigger configuration (FR2); the `top-nav-heading` target (FR1); line truncation, part order, and `headerEndContent` (FR1); `as` and `LinkProvider` rendering (FR3); the chevron button's size (FR4); FR6; the popover's placement (FR7); and FR9.
diff --git a/docs/specs/components/TopNav/TopNavItem.spec.md b/docs/specs/components/TopNav/TopNavItem.spec.md
index 4c407084b0..b1726cfd5a 100644
--- a/docs/specs/components/TopNav/TopNavItem.spec.md
+++ b/docs/specs/components/TopNav/TopNavItem.spec.md
@@ -14,6 +14,7 @@ verified_by:
[
packages/core/src/TopNav/TopNav.test.tsx,
apps/storybook/stories/TopNav.stories.tsx,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families: [family:navigation-destinations]
@@ -163,11 +164,12 @@ is recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ---------------- | ------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------ | -------------------------------- |
-| FR1, ORD1 | `TopNav.test.tsx` TopNavItem anchor, `as`, LinkProvider tests | Default, `as`, provider | Wrong element or lost precedence fails. | `audit:TopNavItem/behavior` |
-| FR2–FR4, AR1–AR3 | `TopNav.test.tsx` TopNavItem state tests | Selected, disabled, icon only | Missing attribute or a navigating disabled item fails. | `audit:TopNavItem/accessibility` |
-| FR5 | `TopNav.test.tsx` disabled-navigation tests in both modes | Default and drawer | Lost click forwarding or href handling fails. | `audit:TopNavItem/behavior` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------ | -------------------------------------------------------------------- | -------------------------------- |
+| FR1, ORD1 | `TopNav.test.tsx` TopNavItem anchor, `as`, LinkProvider tests | Default, `as`, provider | Wrong element or lost precedence fails. | `audit:TopNavItem/behavior` |
+| FR2–FR4, AR1–AR3 | `TopNav.test.tsx` TopNavItem state tests | Selected, disabled, icon only | Missing attribute or a navigating disabled item fails. | `audit:TopNavItem/accessibility` |
+| FR5 | `TopNav.test.tsx` disabled-navigation tests in both modes | Default and drawer | Lost click forwarding or href handling fails. | `audit:TopNavItem/behavior` |
+| RTL relation (FR1) | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `TopNav / Full example` | The `Dashboard` item's leading icon; LTR and RTL | A leading icon that is not at the inline start of its item fails D2. | `audit:TopNavItem/i18n-rtl` |
Pending conformance: the TopNavItem state test and the two disabled-navigation
tests assert `tabIndex=-1` on a disabled item, pinning FR3's implementation
diff --git a/docs/specs/components/TopNav/TopNavMegaMenu.spec.md b/docs/specs/components/TopNav/TopNavMegaMenu.spec.md
index 27b35de682..0a1707b28d 100644
--- a/docs/specs/components/TopNav/TopNavMegaMenu.spec.md
+++ b/docs/specs/components/TopNav/TopNavMegaMenu.spec.md
@@ -14,6 +14,7 @@ verified_by:
[
packages/core/src/TopNav/TopNavMegaMenu.test.tsx,
apps/storybook/stories/TopNavMenu.stories.tsx,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families: [family:overlay-dismissal]
@@ -166,13 +167,14 @@ map is recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ----------------- | ------------------------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------- | ------------------------------------ |
-| FR1, FR5, AR1–AR2 | `TopNavMegaMenu.test.tsx` default-mode and popup-semantics suites | Closed and open | A menu role, dialog wrapper, or broken link fails. | `audit:TopNavMegaMenu/accessibility` |
-| FR2, FR3 | `TopNavMegaMenu.test.tsx` hover/click guard and dismissal suites | Hover, click, leave, sibling, light dismiss | A lost guard or stale open state fails. | `audit:TopNavMegaMenu/behavior` |
-| FR4 | `TopNavMegaMenu.test.tsx` keyboard suite | Enter, Space, Escape | Toggling closed or lost focus return fails. | `audit:TopNavMegaMenu/accessibility` |
-| FR8 | `TopNavMegaMenu.test.tsx` pass-through and owned-handler suites | Bar and drawer | A replaced handler fails. | `audit:TopNavMegaMenu/behavior` |
-| FR9–FR11, AR3 | `TopNavMegaMenu.test.tsx` mobile-bar, drawer, and focus-ring suites | Collapsed and expanded | Reachable collapsed content or a missing ring fails. | `audit:TopNavMegaMenu/behavior` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ----------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------ |
+| FR1, FR5, AR1–AR2 | `TopNavMegaMenu.test.tsx` default-mode and popup-semantics suites | Closed and open | A menu role, dialog wrapper, or broken link fails. | `audit:TopNavMegaMenu/accessibility` |
+| FR2, FR3 | `TopNavMegaMenu.test.tsx` hover/click guard and dismissal suites | Hover, click, leave, sibling, light dismiss | A lost guard or stale open state fails. | `audit:TopNavMegaMenu/behavior` |
+| FR4 | `TopNavMegaMenu.test.tsx` keyboard suite | Enter, Space, Escape | Toggling closed or lost focus return fails. | `audit:TopNavMegaMenu/accessibility` |
+| FR8 | `TopNavMegaMenu.test.tsx` pass-through and owned-handler suites | Bar and drawer | A replaced handler fails. | `audit:TopNavMegaMenu/behavior` |
+| FR9–FR11, AR3 | `TopNavMegaMenu.test.tsx` mobile-bar, drawer, and focus-ring suites | Collapsed and expanded | Reachable collapsed content or a missing ring fails. | `audit:TopNavMegaMenu/behavior` |
+| RTL relation | RTL audit curated D4 target (`apps/storybook/rtl-audit/targets.json`) on `TopNavMenu / Mega menu` (panel opened) | An open start-aligned mega menu panel; LTR and RTL | A panel that does not move to the mirrored side of the page in RTL fails D4. | `audit:TopNavMegaMenu/i18n-rtl` |
Read from source, with no focused test yet: the visually hidden close button after the group (FR5); the forwarded `ref`, the `top-nav-mega-menu` target and its `mode` state, and the bar and drawer chevrons' turn (FR1, FR9); the drawer group's clipping while it expands and its height animation (FR9); where a click-open puts focus (FR5); the caller `preventDefault()` cancellation (FR8); anchoring below the enclosing `<nav>` and slot alignment (FR2); FR6; FR7; and the bar trigger's focus outline (FR11).
diff --git a/docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md b/docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md
index f530519723..4aab9358eb 100644
--- a/docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md
+++ b/docs/specs/components/TopNav/TopNavMegaMenuItem.spec.md
@@ -10,7 +10,11 @@ approved_by: cixzhang
approved_at: 2026-10-25
owners: [cixzhang]
review_triggers: [public-api, behavior, accessibility]
-verified_by: [packages/core/src/TopNav/TopNavMegaMenu.test.tsx]
+verified_by:
+ [
+ packages/core/src/TopNav/TopNavMegaMenu.test.tsx,
+ apps/storybook/rtl-audit/targets.json,
+ ]
modules: []
families: [family:navigation-destinations]
design_specs: [design:reduced-motion]
@@ -133,11 +137,12 @@ anatomy-theming map is recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| -------- | ------------------------------------------------------------------ | --------------------------- | ---------------------------------------- | ---------------------------------------- |
-| FR1, FR2 | `TopNavMegaMenu.test.tsx` TopNavMegaMenuItem and drawer-item tests | Desktop; drawer link/button | Wrong element or lost description fails. | `audit:TopNavMegaMenuItem/behavior` |
-| FR3 | `TopNavMegaMenu.test.tsx` TopNavMegaMenuItem pass-through tests | Both modes | Dropped props or styling fails. | `audit:TopNavMegaMenuItem/behavior` |
-| FR4 | `TopNavMegaMenu.test.tsx` drawer focus-ring test | Drawer item | Missing shared ring classes fail. | `audit:TopNavMegaMenuItem/accessibility` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------ | ---------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------------------- | ---------------------------------------- |
+| FR1, FR2 | `TopNavMegaMenu.test.tsx` TopNavMegaMenuItem and drawer-item tests | Desktop; drawer link/button | Wrong element or lost description fails. | `audit:TopNavMegaMenuItem/behavior` |
+| FR3 | `TopNavMegaMenu.test.tsx` TopNavMegaMenuItem pass-through tests | Both modes | Dropped props or styling fails. | `audit:TopNavMegaMenuItem/behavior` |
+| FR4 | `TopNavMegaMenu.test.tsx` drawer focus-ring test | Drawer item | Missing shared ring classes fail. | `audit:TopNavMegaMenuItem/accessibility` |
+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `TopNavMenu / Mega menu` (panel opened) | Item icon and text; LTR and RTL | An icon that is not at the inline start of its text fails D2. | `audit:TopNavMegaMenuItem/i18n-rtl` |
Read from source, with no focused test yet: the drawer button's `type="button"` (FR2); a desktop item's `onClick` and icon box (FR1); press feedback (FR4); the `div` for a desktop item without `href` (FR1); the desktop item's forwarded `tabIndex` (FR3); the forwarded `ref` and the `top-nav-mega-menu-item` target and its `mode` state (FR1–FR3); the `as` and `LinkProvider` precedence (FR1, ORD1); closing the drawer on activation (FR2) and the desktop focus outline (FR4).
diff --git a/docs/specs/components/TopNav/TopNavMenu.spec.md b/docs/specs/components/TopNav/TopNavMenu.spec.md
index 70f4145130..db2def40a3 100644
--- a/docs/specs/components/TopNav/TopNavMenu.spec.md
+++ b/docs/specs/components/TopNav/TopNavMenu.spec.md
@@ -15,6 +15,7 @@ verified_by:
packages/core/src/TopNav/TopNavMenu.test.tsx,
packages/core/src/hooks/useMenuHover.test.tsx,
apps/storybook/stories/TopNavMenu.stories.tsx,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families:
@@ -175,14 +176,15 @@ recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ----------------- | ----------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------- | -------------------------------- |
-| FR1, FR3, AR1 | `TopNavMenu.test.tsx` trigger and semantics tests | Closed and open | A dialog wrapper or wrong popup type fails. | `audit:TopNavMenu/accessibility` |
-| FR4, FR5, AR2 | `TopNavMenu.test.tsx` keyboard tests | Arrows, wrap, typeahead, Enter, Escape | Extra tab stops or lost activation fails. | `audit:TopNavMenu/accessibility` |
-| FR6 | `TopNavMenu.test.tsx` pass-through and owned-handler tests | Bar and drawer triggers | A replaced built-in handler or lost prop fails. | `audit:TopNavMenu/behavior` |
-| FR7, FR10, AR3 | `TopNavMenu.test.tsx` drawer tests | Collapsed and expanded | Reachable collapsed items or a missing ring fails. | `audit:TopNavMenu/behavior` |
-| Shared menu focus | `useMenuHover.test.tsx` | Hover-open, click-open, Escape, Enter and Space | Focus moved on hover, not moved in on click, or not returned on Escape fails. | `audit:TopNavMenu/accessibility` |
-| FR11 | `TopNavMenu.test.tsx` action-group suite (touch and mouse slides) | Touch and mouse slides across items; undraggable link items | Removing the adoption fails the slide tests. | — |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ----------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------- | -------------------------------- |
+| FR1, FR3, AR1 | `TopNavMenu.test.tsx` trigger and semantics tests | Closed and open | A dialog wrapper or wrong popup type fails. | `audit:TopNavMenu/accessibility` |
+| FR4, FR5, AR2 | `TopNavMenu.test.tsx` keyboard tests | Arrows, wrap, typeahead, Enter, Escape | Extra tab stops or lost activation fails. | `audit:TopNavMenu/accessibility` |
+| FR6 | `TopNavMenu.test.tsx` pass-through and owned-handler tests | Bar and drawer triggers | A replaced built-in handler or lost prop fails. | `audit:TopNavMenu/behavior` |
+| FR7, FR10, AR3 | `TopNavMenu.test.tsx` drawer tests | Collapsed and expanded | Reachable collapsed items or a missing ring fails. | `audit:TopNavMenu/behavior` |
+| Shared menu focus | `useMenuHover.test.tsx` | Hover-open, click-open, Escape, Enter and Space | Focus moved on hover, not moved in on click, or not returned on Escape fails. | `audit:TopNavMenu/accessibility` |
+| FR11 | `TopNavMenu.test.tsx` action-group suite (touch and mouse slides) | Touch and mouse slides across items; undraggable link items | Removing the adoption fails the slide tests. | — |
+| RTL relation | RTL audit curated D4 target (`apps/storybook/rtl-audit/targets.json`) on `TopNavMenu / Default` (menu opened) | An open start-aligned menu panel; LTR and RTL | A panel that does not move to the mirrored side of the page in RTL fails D4. | `audit:TopNavMenu/i18n-rtl` |
Read from source, with no focused test yet: the visually hidden close button after the menu (FR3); the native `<a>` for bar items, the icon box, and the description (FR4); the forwarded `ref`, the `top-nav-menu` target, and the bar and drawer chevrons' turn (FR1, FR7); the drawer group's clipping while it expands and its height animation (FR7); the caller `preventDefault()` cancellation (FR6); hover opening and closing with `delay` and `hideDelay` (FR2); slot alignment (FR3); FR8; FR9; and the bar trigger and item parts of FR10.