Skip to content

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

TypeScript

[Component Audit] DropdownMenuItem: make action states reviewable (#7907)

Cindy Zhang948e75d3626b
diff --git a/.changeset/dropdown-menu-item-audit-docs.md b/.changeset/dropdown-menu-item-audit-docs.md
new file mode 100644
index 0000000000..69e2e6b937
--- /dev/null
+++ b/.changeset/dropdown-menu-item-audit-docs.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[docs] Clarify DropdownMenuItem action, destination, disabled, and supporting-content guidance.
+
+@cixzhang
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index af08c1d910..9031d4554a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2894,6 +2894,39 @@ jobs:
retention-days: 30
if-no-files-found: error
+ # DropdownMenuItem owns one interactive pointer-menu row. Its label, icon,
+ # description, and end content follow logical document direction; the row
+ # uses logical inline padding and start-aligned text. Parent DropdownMenu
+ # owns directional placement and keyboard navigation.
+ - name: Run DropdownMenuItem audit browser evidence
+ if: ${{ !cancelled() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuItem:') }}
+ env:
+ ASTRYX_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ status=0
+ node .github/scripts/accessibility-audit.js \
+ --storybook-dir apps/storybook/dist \
+ --output dropdown-menu-item-a11y-report.json \
+ --components DropdownMenuItem \
+ --ready-selector '[role="menu"]' \
+ --baseline .github/a11y-baseline.json \
+ --fail-on-new || status=1
+ pnpm exec playwright test \
+ packages/core/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts \
+ --project chromium || status=1
+ exit "$status"
+
+ - name: Upload DropdownMenuItem audit evidence
+ if: always() && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, '[Component Audit] DropdownMenuItem:')
+ uses: actions/upload-artifact@v7
+ with:
+ name: dropdown-menu-item-audit-evidence-${{ needs.build-storybook.outputs.short_hash }}
+ path: |
+ dropdown-menu-item-a11y-report.json
+ dropdown-menu-item-audit-evidence/
+ retention-days: 30
+ if-no-files-found: error
+
# ContextMenu owns pointer and touch presentations across cursor anchoring,
# selectable rows, sections, inline triggers, RTL, and narrow viewports.
# Its audit lane binds the rendered matrix to the exact pull-request head.
diff --git a/apps/storybook/rtl-audit/verified-not-applicable.json b/apps/storybook/rtl-audit/verified-not-applicable.json
index 93cd1fb02c..889476ffaf 100644
--- a/apps/storybook/rtl-audit/verified-not-applicable.json
+++ b/apps/storybook/rtl-audit/verified-not-applicable.json
@@ -379,6 +379,15 @@
"component": "lab/Comments",
"reason": "Comments is a block-axis timeline of CommentThread rows and activity events inside the core ChatLayout and ChatMessageList, with the composer docked on the block axis. It adds no horizontal positioning, directional glyphs, or arrow-key behavior of its own: rows, rails, and dividers use logical properties, and the load-earlier control and error Banners are centered or full width."
},
+ {
+ "component": "core/DropdownMenuItem",
+ "reason": "DropdownMenuItem owns one interactive pointer-menu row whose label, icon, description, and end content follow logical document direction. Its insets use logical properties and its text uses start alignment; it renders no component-owned directional glyph, physical inline placement, reordered controls, horizontal scrolling or dragging, side-placed overlay, or horizontal keyboard behavior. DropdownMenu owns directional placement and keyboard navigation. Exact-head frames still render RTL to confirm inherited direction without adding a component-owned RTL dimension.",
+ "evidence": {
+ "apps/storybook/stories/DropdownMenuItem.stories.tsx": "sha256:62c041b50e970a0485490de20655fc788b3ea0e848cdcf7464d3725b030281f8",
+ "packages/core/src/DropdownMenu/DropdownMenuItem.tsx": "sha256:3d5ee9cb5422c7fa560a3546ec6783c9473c925a795dd266a8757fe420555d44",
+ "packages/core/src/DropdownMenu/index.ts": "sha256:59bf02be4a577cbecf3ad7e981e2577602375892f74548593aa9b998cae733fa"
+ }
+ },
{
"component": "core/DropdownMenuGroup",
"reason": "DropdownMenuGroup owns a block-axis set of menu rows and an optional heading with symmetric logical inline padding. It renders no directional glyph, physical inline placement, reordered content, horizontal scrolling or dragging, side-placed overlay, or horizontal keyboard behavior of its own; DropdownMenu owns menu placement and row navigation. The exact-head audit still renders RTL frames to confirm inherited direction without adding a component-owned RTL dimension.",
diff --git a/apps/storybook/stories/DropdownMenuItem.stories.tsx b/apps/storybook/stories/DropdownMenuItem.stories.tsx
new file mode 100644
index 0000000000..0f9533b0fc
--- /dev/null
+++ b/apps/storybook/stories/DropdownMenuItem.stories.tsx
@@ -0,0 +1,105 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file DropdownMenuItem.stories.tsx
+ * @input Uses one open pointer menu containing every DropdownMenuItem content and state branch
+ * @output Component-owned rendered evidence for action, link, destructive, disabled, and supporting-content rows
+ * @position Storybook evidence; keeps the closed public state inventory reachable from one bounded fixture
+ */
+
+import type {Meta, StoryObj} from '@storybook/react';
+import {useState} from 'react';
+import {expect, userEvent, within} from 'storybook/test';
+import {DropdownMenu, DropdownMenuItem} from '@astryxdesign/core/DropdownMenu';
+import {
+ Cog6ToothIcon,
+ DocumentDuplicateIcon,
+ PencilIcon,
+ TrashIcon,
+} from '@heroicons/react/24/outline';
+
+const meta: Meta<typeof DropdownMenuItem> = {
+ title: 'Core/DropdownMenuItem',
+ component: DropdownMenuItem,
+ tags: ['autodocs', 'visual-theme-matrix'],
+ parameters: {
+ layout: 'centered',
+ docs: {
+ description: {
+ component:
+ 'One pointer-menu row for an action or destination. The parent menu owns keyboard navigation; the row owns activation, disabled state, optional destination semantics, content layout, and its theme target.',
+ },
+ },
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof DropdownMenuItem>;
+
+function ItemStatesFixture() {
+ const [hasCopied, setHasCopied] = useState(false);
+ return (
+ <DropdownMenu
+ button={{label: 'Open item evidence'}}
+ menuWidth={280}
+ presentation="popover">
+ <DropdownMenuItem
+ data-testid="default-row"
+ icon={PencilIcon}
+ label="Edit project"
+ onClick={() => {}}
+ />
+ <DropdownMenuItem
+ data-testid="supporting-row"
+ icon={DocumentDuplicateIcon}
+ label="Duplicate project"
+ description="Create an editable copy"
+ endContent={
+ <span aria-live="polite" role="status">
+ {hasCopied ? 'Copied' : <span aria-hidden="true">⌘D</span>}
+ </span>
+ }
+ hasCloseOnSelect={false}
+ onClick={() => setHasCopied(true)}
+ />
+ <DropdownMenuItem
+ data-testid="destructive-row"
+ icon={TrashIcon}
+ label="Delete project"
+ variant="destructive"
+ onClick={() => {}}
+ />
+ <DropdownMenuItem
+ data-testid="disabled-row"
+ label="Archive unavailable"
+ isDisabled
+ onClick={() => {}}
+ />
+ <DropdownMenuItem
+ data-testid="link-row"
+ icon={Cog6ToothIcon}
+ label="Project settings"
+ href="/settings"
+ />
+ </DropdownMenu>
+ );
+}
+
+export const ItemStates: Story = {
+ render: () => <ItemStatesFixture />,
+ play: async ({canvasElement}) => {
+ const canvas = within(canvasElement);
+ await userEvent.click(
+ canvas.getByRole('button', {name: 'Open item evidence'}),
+ );
+ const menu = await within(document.body).findByRole('menu');
+ const scope = within(menu);
+ await expect(scope.getAllByRole('menuitem')).toHaveLength(5);
+ await expect(
+ scope.getByRole('menuitem', {name: 'Archive unavailable'}),
+ ).toHaveAttribute('aria-disabled', 'true');
+ await expect(
+ scope.getByRole('menuitem', {name: 'Project settings'}),
+ ).toHaveAttribute('href', '/settings');
+ },
+};
diff --git a/packages/cli/test/core-doc-types.known-drift.json b/packages/cli/test/core-doc-types.known-drift.json
index b05d0e1e1e..a6827fbe59 100644
--- a/packages/cli/test/core-doc-types.known-drift.json
+++ b/packages/cli/test/core-doc-types.known-drift.json
@@ -43,7 +43,6 @@
"packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs docsDense isHiddenFromOverview unknown_field",
"packages/core/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs docsZh isHiddenFromOverview unknown_field",
"packages/core/src/DropdownMenu/DropdownMenuDivider.doc.mjs docsDense isHiddenFromOverview unknown_field",
- "packages/core/src/DropdownMenu/DropdownMenuItem.doc.mjs docsDense isHiddenFromOverview unknown_field",
"packages/core/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs docsDense isHiddenFromOverview unknown_field",
"packages/core/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs docsZh isHiddenFromOverview unknown_field",
"packages/core/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs docsDense isHiddenFromOverview unknown_field",
diff --git a/packages/cli/test/core-prop-docs.known-drift.json b/packages/cli/test/core-prop-docs.known-drift.json
index 9d7667c971..73a1e07d3c 100644
--- a/packages/cli/test/core-prop-docs.known-drift.json
+++ b/packages/cli/test/core-prop-docs.known-drift.json
@@ -20,8 +20,6 @@
"src/DropdownMenu/DropdownMenu.doc.mjs DropdownMenu.items required_mismatch",
"src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs DropdownMenuCheckboxItem.label required_mismatch",
"src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs DropdownMenuCheckboxItem.value required_mismatch",
- "src/DropdownMenu/DropdownMenuItem.doc.mjs DropdownMenuItem.isDisabled not_in_doc",
- "src/DropdownMenu/DropdownMenuItem.doc.mjs DropdownMenuItem.label required_mismatch",
"src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs DropdownMenuRadioGroup.children required_mismatch",
"src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs DropdownMenuRadioGroup.label required_mismatch",
"src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs DropdownMenuRadioGroup.onChange required_mismatch",
diff --git a/packages/core/src/DropdownMenu/DropdownMenuItem.doc.mjs b/packages/core/src/DropdownMenu/DropdownMenuItem.doc.mjs
index f74833c215..af4872d07e 100644
--- a/packages/core/src/DropdownMenu/DropdownMenuItem.doc.mjs
+++ b/packages/core/src/DropdownMenu/DropdownMenuItem.doc.mjs
@@ -8,7 +8,50 @@ export const docs = {
displayName: 'Dropdown Menu Item',
isHiddenFromOverview: true,
description:
- 'Helper component for custom item rendering with consistent styling. Host attributes and DOM event handlers (aria-*, data-*, id, drag and drop) reach the row root, the element carrying role="menuitem".',
+ 'One action or destination row in the pointer presentation of DropdownMenu. The parent menu owns keyboard navigation; the row owns activation, disabled state, destination behavior, content layout, and its theme target. Supported host attributes, DOM handlers, className, style, xstyle, and ref reach or compose on the role="menuitem" root.',
+ usage: {
+ description:
+ 'Use DropdownMenuItem inside DropdownMenu compound mode for one action or destination. Keep label, description, icon, and endContent non-interactive; controls belong in separate rows or the menu header/footer.',
+ bestPractices: [
+ {
+ guidance: true,
+ description:
+ 'Use href for a destination so LinkProvider, modified clicks, middle clicks, and browser link affordances remain available.',
+ },
+ {
+ guidance: true,
+ description:
+ 'Use hasCloseOnSelect=false only when activation reports a result in place on the same row.',
+ },
+ {
+ guidance: false,
+ description:
+ 'Put buttons, links, or other focusable controls inside label, description, or endContent. Each menu row is one interactive target.',
+ },
+ ],
+ anatomy: [
+ {
+ name: 'Row',
+ required: true,
+ description:
+ 'The role="menuitem" root that owns activation, disabled state, destination behavior, and theme state.',
+ },
+ {
+ name: 'Content',
+ required: true,
+ description:
+ 'The non-interactive label plus optional icon, description, and end content.',
+ },
+ ],
+ },
+ theming: {
+ targets: [
+ {
+ className: 'astryx-dropdown-menu-item',
+ visualProps: ['size', 'variant'],
+ },
+ ],
+ },
playground: {
// Standalone DropdownMenuItem has no required props, so the properties-tab
// preview renders an empty row without seeded content. Seed a label and
@@ -26,6 +69,7 @@ export const docs = {
name: 'label',
type: 'ReactNode',
description: 'Primary label text.',
+ required: true,
},
{
name: 'description',
@@ -55,11 +99,18 @@ export const docs = {
description:
'Link relationship. noopener noreferrer is added for target="_blank". Only used with href.',
},
+ {
+ name: 'isDisabled',
+ type: 'boolean',
+ description:
+ 'Whether the row is unavailable. Disabled rows expose aria-disabled, remove link destinations, and suppress activation.',
+ default: 'false',
+ },
{
name: 'endContent',
type: 'ReactNode',
description:
- 'Additional content rendered after the label and description.',
+ 'Non-interactive content rendered after the label and description.',
},
{
name: 'hasCloseOnSelect',
@@ -95,7 +146,7 @@ export const docsZh = {
isHiddenFromOverview: true,
displayName: 'Dropdown Menu Item',
description:
- '用于自定义项渲染的辅助组件,提供一致的样式。宿主属性和 DOM 事件处理器(aria-*、data-*、id、拖放)会落在行根元素上,即带 role="menuitem" 的元素。',
+ 'DropdownMenu 指针呈现中的一个操作或目标行。父菜单负责键盘导航;该行负责激活、禁用状态、目标行为、内容布局和主题目标。支持的宿主属性、DOM 处理程序、className、style、xstyle 和 ref 会落在或组合到 role="menuitem" 根元素上。',
props: [
{
name: 'icon',
@@ -106,6 +157,7 @@ export const docsZh = {
name: 'label',
type: 'ReactNode',
description: '主标签文本。',
+ required: true,
},
{
name: 'description',
@@ -134,10 +186,16 @@ export const docsZh = {
type: 'string',
description: '链接关系。target="_blank" 时自动加入 noopener noreferrer。',
},
+ {
+ name: 'isDisabled',
+ type: 'boolean',
+ description: '该行是否不可用;不可用的行不会激活或导航。',
+ default: 'false',
+ },
{
name: 'endContent',
type: 'ReactNode',
- description: '在标签和描述之后渲染的附加内容。',
+ description: '在标签和描述之后渲染的非交互式附加内容。',
},
{
name: 'hasCloseOnSelect',
@@ -168,9 +226,9 @@ export const docsZh = {
export const docsDense = {
name: 'DropdownMenuItem',
- isHiddenFromOverview: true,
displayName: 'Dropdown Menu Item',
- description: 'helper for custom item rendering w/ consistent styling',
+ description:
+ 'one pointer-menu action/destination row; parent owns keyboard, row owns activation, state, destination, content, and root inputs',
propDescriptions: {
icon: 'icon before label',
label: 'primary label text',
@@ -180,7 +238,8 @@ export const docsDense = {
href: 'row is a real anchor w/ role=menuitem; modified/middle click keeps browser meaning',
target: "link target ('_blank' | '_self'), with href",
rel: 'link rel; noopener noreferrer added for _blank',
- endContent: 'additional content after label+description',
+ isDisabled: 'unavailable; removes destinations and suppresses activation',
+ endContent: 'non-interactive content after label+description',
hasCloseOnSelect:
'false keeps the menu open on activation (in-place result on the item)',
variant:
diff --git a/packages/core/src/DropdownMenu/DropdownMenuItem.spec.md b/packages/core/src/DropdownMenu/DropdownMenuItem.spec.md
new file mode 100644
index 0000000000..d229cdf8df
--- /dev/null
+++ b/packages/core/src/DropdownMenu/DropdownMenuItem.spec.md
@@ -0,0 +1,209 @@
+---
+schema_version: 3
+template_version: 7
+kind: component
+id: component:DropdownMenuItem
+authority: draft
+archive_reason: null
+superseded_by: null
+approved_by: null
+approved_at: null
+owners: [cixzhang]
+review_triggers: [public-api, behavior, accessibility, theming, testing]
+verified_by:
+ [
+ packages/core/src/DropdownMenu/DropdownMenu.test.tsx,
+ packages/core/src/DropdownMenu/__tests__/Menu.a11y.test.tsx,
+ packages/core/src/theme/themingTargets.test.ts,
+ apps/storybook/stories/DropdownMenuItem.stories.tsx,
+ apps/storybook/rtl-audit/verified-not-applicable.json,
+ scripts/check-knowledge.mjs,
+ ]
+modules: []
+families: [family:navigation-destinations]
+design_specs: []
+architecture:
+ [
+ architecture:public-component-api,
+ architecture:component-theming-surface,
+ architecture:component-test-sufficiency,
+ architecture:interaction-modality,
+ ]
+contributing: []
+system_specs: [spec:AST-020, spec:AST-029]
+---
+
+# DropdownMenuItem component contract
+
+## Contract at a glance
+
+| Area | Contract |
+| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Public contract | One compound pointer-menu row for an action or destination, with label, supporting content, disabled state, destructive paint, optional close suppression, root inputs, and a forwarded ref. |
+| Behavior | The parent menu owns roving focus and keyboard activation; the row owns click order, disabled suppression, close-on-select, destination handoff, hover focus, and its visible content composition. |
+| End-user impact | Actions and destinations preserve keyboard, pointer, and browser link behavior while unavailable rows remain inert and destructive actions remain identifiable. |
+| Builder impact | Destinations use `href`; supporting content stays non-interactive; `hasCloseOnSelect=false` is reserved for in-place result feedback. |
+| Compatibility/readiness | Patch-compatible observational contract. Runtime, exports, defaults, and theme targets remain unchanged; authority stays `draft` until exact-head owner approval. |
+| Review checks | Reject nested controls, disabled activation, lost destination safety, broken modified-click behavior, dropped root inputs, a second keyboard owner, or state/target reflection moved off the row. |
+| Governing rules | `family:navigation-destinations/FR1–FR5`; `architecture:public-component-api/INV5–INV9`; `architecture:component-theming-surface/INV3–INV6`; `spec:AST-020/FR1,FR2,FR6,FR15`. |
+
+This table is a review projection; the body below is authoritative.
+
+## Intent
+
+DropdownMenuItem renders one compound-mode row in the pointer presentation of
+DropdownMenu. It owns the row element, content slots, action-versus-destination
+branch, activation order, disabled and destructive state, root composition, and
+`dropdown-menu-item` theme target. DropdownMenu owns the surrounding menu,
+keyboard collection, focus movement, typeahead, presentation choice, and close
+lifecycle.
+
+## Compatibility and migration
+
+- Released default preserved: yes.
+- Compatibility class: observational patch; no behavior or public surface changes.
+- Controlled/uncontrolled behavior: not applicable.
+- Migration decision: none.
+
+Consumer migration instructions belong in consumer docs and release notes.
+
+## Ownership boundary
+
+**Owns**
+
+- One `role="menuitem"` root and its label, description, icon, end content,
+ disabled state, destructive variant, ref, supported host inputs, and styling inputs.
+- Action callback order and `hasCloseOnSelect` behavior.
+- Link-row rendering, destination handoff, modified/middle-click preservation,
+ target and relationship handling, and disabled-link inertness.
+- Pointer hover focus and the row's press/hover/focus paint.
+- The `dropdown-menu-item` target and its size/variant state reflection.
+
+**Does not own / non-goals**
+
+- Menu naming, open/close state, focus entry, roving focus, typeahead, and keyboard
+ click synthesis — owned by DropdownMenu and its shared hooks.
+- Touch and bottom-sheet row rendering — the parent presentation delegates those
+ rows to List.
+- Destination acceptance and blocking — owned by `family:navigation-destinations`.
+- Interactive controls inside label, description, or end content. Controls belong
+ beside the menu or as separate rows.
+
+## Public concepts
+
+| Concept | Closed values or states | Meaning | Availability | Default | Owner | Stability | Invalid-value behavior |
+| ------------ | --------------------------------------------------- | ------------------------------------------------------------------------------ | --------------------------- | ------- | ------------------------------- | --------- | ------------------------------------------------------------ |
+| Row act | action; destination | Runs a callback or exposes a browser/router destination from the row itself. | Every enabled row | action | component and navigation family | stable | A blocked destination is inert; a disabled link has no href. |
+| Availability | enabled; disabled | Controls whether the row can receive focus or activate. | Every row | enabled | component and parent menu | stable | Disabled suppresses activation and destination. |
+| Close policy | close; remain open | Whether successful activation closes the parent menu. | Action and destination rows | close | component | stable | Omission closes. |
+| Visual state | default; destructive; hover; focus; press; disabled | Paints row meaning and interaction state without changing menuitem semantics. | Pointer row | default | component | stable | Unknown variants are rejected by the public type. |
+| Root surface | ref; DOM/data/ARIA; class/style/xstyle/events | Extends the row root while preserving component-owned role and keyboard state. | Every pointer row | omitted | public component API | stable | Accepted inputs compose; owned role/tab stop remain fixed. |
+
+## Behavioral and layout contract
+
+Draft requirements identify their basis so observed code is not mistaken for an
+intentional decision.
+
+| ID | Candidate invariant | Basis | Draft review state |
+| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------ |
+| FR1 | The pointer row MUST expose one `role="menuitem"` root. Label, description, icon, and end content remain presentational content of that row rather than nested controls. | WAI-ARIA menu pattern; released source/docs | verify |
+| FR2 | Enabled activation MUST run the row callback before optional close. Disabled rows MUST expose `aria-disabled=true`, remove link destinations, and run neither callback nor close. | Released behavior; focused tests | verify |
+| FR3 | A destination row MUST render as the link root through LinkProvider. Plain activation runs the callback then closes and navigates; modified and middle clicks preserve browser behavior without running the callback; blocked schemes are inert. | `family:navigation-destinations/FR1–FR5`; released tests | verify |
+| FR4 | The parent menu MUST remain the only keyboard owner. It synthesizes click activation with modifiers, moves focus, and runs typeahead; the row MAY focus itself on pointer hover but MUST NOT create a second roving-focus model. | `architecture:interaction-modality`; current parent tests | verify |
+| FR5 | The visible root MUST carry `dropdown-menu-item`; size and destructive state MUST reflect through `themeProps`; semantic tokens own layout and paint before caller styling inputs compose. | `architecture:component-theming-surface/INV3–INV6`; source/tests | verify |
+| FR6 | Ref, supported host attributes and handlers, `className`, `style`, and `xstyle` MUST reach or compose on the row root without replacing owned role, tab stop, disabled behavior, destination handling, or activation order. | `architecture:public-component-api/INV5–INV9`; focused tests | verify |
+| FR7 | Disabled menu rows remain inert. Whether the menu keyboard model should visit them is unresolved at the shared owner and MUST NOT be changed by a component-local audit. | WAI-ARIA menu pattern; parent `component:DropdownMenu/OQ1` | human API decision |
+| FR8 | Keyboard focus MUST remain perceivable, including in forced-colors mode. The current background-only treatment is an objective gap; a remediation must preserve modality and row-content visibility without inventing new ordinary-theme appearance. | WCAG 2.2 SC 1.4.11 and 2.4.7; current rendered behavior | objective gap; owner must confirm the shared visual boundary |
+
+### Allowed variation
+
+- **AV1 — Content.** Non-interactive icons, text, descriptions, shortcuts, badges,
+ and status text may vary without changing the row's menuitem semantics.
+- **AV2 — Theme paint.** A theme may restyle the target's admitted properties while
+ preserving visible state distinctions and forced-colors focus.
+- **AV3 — Parent size.** The parent menu supplies `sm`, `md`, or `lg`; the row reflects
+ that state and may vary its tokenized insets.
+
+### Representative states
+
+| State | Required invariant | Allowed variation |
+| ---------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------- |
+| Enabled action | Callback runs, then close follows the close policy. | Content, size, and visual variant. |
+| In-place result action | Callback runs and the menu remains open. | Label/end content may update. |
+| Disabled action | `aria-disabled=true`; callback, hover focus, and close are suppressed. | Content remains visible. |
+| Destination | One anchor root preserves safe destination and browser activation behavior. | Target, rel, router provider, and content. |
+| Destructive | Error-role paint applies to label, icon, and description without changing behavior. | Other row content remains consumer-authored. |
+| Keyboard focus | Parent focus lands on the row and remains visible. | Exact theme-owned paint may vary. |
+| RTL / narrow viewport | Logical insets and start alignment follow direction without horizontal overflow. | Menu placement remains parent-owned. |
+
+### Transformation and precedence order
+
+- **ORD1 — Activation.** Disabled guard → browser-navigation classification → row
+ callback where applicable → close policy → browser/router navigation.
+- **ORD2 — Root composition.** Parent size → base row styles → variant/disabled state
+ → caller `xstyle`; target metadata and caller class/style compose on the same root.
+
+### Performance and resources
+
+- **PR1 — Shared press lifecycle.** DropdownMenuItem uses the shared counted press
+ controller through `usePressFeedback`; the first mounted pressable installs the
+ window listeners and the last removes them. The item adds no per-row listener,
+ observer, timer, request, or local resource owner.
+
+## Accessibility contract
+
+- **AR1 — Menu item semantics.** The root is one named `menuitem`; supporting content
+ does not introduce a nested interactive descendant.
+- **AR2 — Disabled state.** Disabled rows expose state and cannot activate or navigate.
+- **AR3 — Keyboard ownership.** DropdownMenu owns focus collection and activation;
+ the item remains a single row in that model.
+- **AR4 — Focus perception.** Focus remains visually perceivable in supported themes
+ and platform accessibility modes; the open forced-colors gap remains explicit.
+
+## Design relationships
+
+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
+| ---------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -------------- | ------------------ |
+| Row | One full-width action/destination target with tokenized insets and start alignment. | Current source and parent menu composition | prominent | FR1–FR6 |
+| Supporting text | Description and end content remain subordinate to the row label. | Delegated Item layout and current consumer docs | supporting | FR1 |
+| Interaction | Hover, focus, press, disabled, and destructive states remain distinguishable. | Current source; forced-colors focus is an unresolved objective gap | prominent | FR5, FR8, AR4 |
+
+No new component-local visual decision is settled by this draft.
+
+## Family and system relationships
+
+- `family:navigation-destinations` owns destination acceptance and blocked-scheme
+ behavior; this component supplies the destination-bearing row.
+- `architecture:public-component-api` owns root input composition, refs, and released
+ compatibility.
+- `architecture:component-theming-surface` owns target placement and state reflection.
+- `architecture:component-test-sufficiency` owns proportionate observable evidence.
+- `architecture:interaction-modality` and DropdownMenu own parent keyboard behavior.
+- `spec:AST-020` supplies WCAG/APG adoption and evidence-layer boundaries.
+- `spec:AST-029` keeps this observational draft separate from the audit receipt.
+
+## Verification map
+
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ---------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
+| FR1–FR4, AR1–AR3 | `DropdownMenu.test.tsx`; reusable Menu accessibility tests; scoped axe | action, destination, disabled, keyboard, modified clicks | A nested control, activation while disabled, lost browser affordance, or second keyboard owner fails observable tests | `audit:DropdownMenuItem/§1,§4,§6` |
+| FR5, FR8, AR4 | theming-target tests; exact-head Neutral/Butter/RTL/narrow/focus/hover frames | default, destructive, disabled, focus, hover | Target/state reflection disappears, paint is absent, or focus becomes unobservable | `audit:DropdownMenuItem/§2,§5` |
+| FR6 | root/ref/handler tests; lint and typecheck | ref, host attributes, class/style/xstyle, pointer handlers | An accepted input is dropped or overrides component-owned semantics | `audit:DropdownMenuItem/§3` |
+| RTL / responsive | source-hashed verified-N/A receipt plus exact-head browser frames | LTR, RTL, 320px | Physical direction leaks into the row or narrow layout overflows | `audit:DropdownMenuItem/§9,§10` |
+
+## Decision log
+
+None. This draft records current facts and introduces no product decision.
+
+## Open questions
+
+- **OQ1 — Which shared keyboard owner should keep disabled menu items discoverable
+ while preserving their inert behavior?** (`human-api`)
+- **OQ2 — Should forced-colors focus use a component-specific system outline, or a
+ shared row-focus treatment that also governs ordinary themes?** (`human-design`)
+
+## Content boundary
+
+This file does not duplicate consumer prop tables/examples, current audit scores,
+screenshot matrices, implementation steps, or family/system rules. The audit pull
+request owns the closed run evidence required by `spec:AST-029/FR5`.
diff --git a/packages/core/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts b/packages/core/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts
new file mode 100644
index 0000000000..aad2c1c656
--- /dev/null
+++ b/packages/core/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts
@@ -0,0 +1,366 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file DropdownMenuItemAudit.a11y.chromium.spec.ts
+ * @input Exact-head DropdownMenuItem story across states, themes, direction, and viewport widths
+ * @output Screenshots and fail-closed sensor receipts for the DropdownMenuItem component audit
+ * @position Component-owned Night Watch browser evidence; CI runs it only for a DropdownMenuItem audit pull request
+ */
+
+import {createHash} from 'node:crypto';
+import {execFileSync} from 'node:child_process';
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import {expect, test, type Page} from '@playwright/test';
+import {holdMotionStill} from '@astryxdesign/a11y-spec/chromium';
+import {
+ DEFAULT_STORYBOOK_DIR,
+ serveStorybook,
+ type StaticServer,
+} from '@astryxdesign/a11y-spec/storybook';
+
+const OUTPUT = path.resolve('dropdown-menu-item-audit-evidence');
+const STORY_ID = 'core-dropdownmenuitem--item-states';
+const WIDE = {width: 1024, height: 768};
+const NARROW = {width: 320, height: 720};
+
+type Mode = 'light' | 'dark';
+type Direction = 'ltr' | 'rtl';
+type Theme = 'neutral' | 'butter';
+type Interaction = 'rest' | 'focus' | 'hover';
+type AuditCase = {
+ key: string;
+ mode: Mode;
+ direction: Direction;
+ theme: Theme;
+ interaction: Interaction;
+ viewport: {width: number; height: number};
+};
+
+const cases: AuditCase[] = [
+ {
+ key: 'neutral-light',
+ mode: 'light',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'neutral-dark',
+ mode: 'dark',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'focus-light',
+ mode: 'light',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'focus',
+ viewport: WIDE,
+ },
+ {
+ key: 'focus-dark',
+ mode: 'dark',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'focus',
+ viewport: WIDE,
+ },
+ {
+ key: 'hover-light',
+ mode: 'light',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'hover',
+ viewport: WIDE,
+ },
+ {
+ key: 'hover-dark',
+ mode: 'dark',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'hover',
+ viewport: WIDE,
+ },
+ {
+ key: 'butter-light',
+ mode: 'light',
+ direction: 'ltr',
+ theme: 'butter',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'butter-dark',
+ mode: 'dark',
+ direction: 'ltr',
+ theme: 'butter',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'rtl-light',
+ mode: 'light',
+ direction: 'rtl',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'rtl-dark',
+ mode: 'dark',
+ direction: 'rtl',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: WIDE,
+ },
+ {
+ key: 'narrow-light',
+ mode: 'light',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: NARROW,
+ },
+ {
+ key: 'narrow-dark',
+ mode: 'dark',
+ direction: 'ltr',
+ theme: 'neutral',
+ interaction: 'rest',
+ viewport: NARROW,
+ },
+];
+
+test.describe.configure({mode: 'serial', retries: 0});
+let server: StaticServer;
+let checkoutSha: string;
+let storybookSha: string;
+
+function storyUrl(item: AuditCase) {
+ return `${server.origin}/iframe.html?id=${STORY_ID}&viewMode=story&globals=colorMode:${item.mode};astryxTheme:${item.theme};direction:${item.direction}`;
+}
+
+async function settle(page: Page) {
+ await holdMotionStill(page);
+ await page.evaluate(async () => document.fonts.ready);
+ await page.waitForTimeout(40);
+}
+
+test.beforeAll(async () => {
+ fs.rmSync(OUTPUT, {recursive: true, force: true});
+ fs.mkdirSync(OUTPUT, {recursive: true});
+ checkoutSha = execFileSync('git', ['rev-parse', 'HEAD'], {
+ encoding: 'utf8',
+ }).trim();
+ const expected = process.env.ASTRYX_HEAD_SHA;
+ if (expected && expected !== checkoutSha) {
+ throw new Error(
+ `checkout ${checkoutSha} does not match expected head ${expected}`,
+ );
+ }
+ server = await serveStorybook(
+ process.env.ASTRYX_STORYBOOK_DIR ?? DEFAULT_STORYBOOK_DIR,
+ );
+ const response = await fetch(`${server.origin}/astryx-build-sha.txt`);
+ if (!response.ok) {
+ throw new Error(`Storybook build has no SHA stamp (${response.status})`);
+ }
+ storybookSha = (await response.text()).trim();
+ if (storybookSha !== checkoutSha) {
+ throw new Error(
+ `Storybook ${storybookSha} does not match checkout ${checkoutSha}`,
+ );
+ }
+});
+
+test.afterAll(async () => {
+ await server?.close();
+});
+
+for (const item of cases) {
+ test(item.key, async ({browser}) => {
+ const context = await browser.newContext({
+ viewport: item.viewport,
+ colorScheme: item.mode,
+ reducedMotion: 'reduce',
+ });
+ const page = await context.newPage();
+ const pageErrors: string[] = [];
+ page.on('pageerror', error => pageErrors.push(String(error)));
+ await page.goto(storyUrl(item), {waitUntil: 'load'});
+ await page.locator('#storybook-root').waitFor();
+
+ const menu = page.getByRole('menu').last();
+ await expect(menu).toBeVisible();
+ const rows = menu.getByRole('menuitem');
+ await expect(rows).toHaveCount(5);
+ const defaultRow = page.getByTestId('default-row');
+ const supportingRow = page.getByTestId('supporting-row');
+ const destructiveRow = page.getByTestId('destructive-row');
+ const disabledRow = page.getByTestId('disabled-row');
+ const linkRow = page.getByTestId('link-row');
+ await expect(disabledRow).toHaveAttribute('aria-disabled', 'true');
+ await expect(destructiveRow).toHaveAttribute('data-variant', 'destructive');
+ await expect(linkRow).toHaveAttribute('href', '/settings');
+ await expect(linkRow).toHaveAttribute('role', 'menuitem');
+ await expect(menu.locator('button, [role="button"]')).toHaveCount(0);
+
+ if (item.interaction === 'focus') {
+ await defaultRow.focus();
+ await expect(defaultRow).toBeFocused();
+ } else if (item.interaction === 'hover') {
+ await supportingRow.hover();
+ }
+ await settle(page);
+
+ const observed = await menu.evaluate(element => {
+ const currentRows = Array.from(
+ element.querySelectorAll<HTMLElement>('[role="menuitem"]'),
+ );
+ const describe = (row: HTMLElement | undefined) => {
+ if (!row) {
+ return null;
+ }
+ const style = getComputedStyle(row);
+ const box = row.getBoundingClientRect();
+ return {
+ tagName: row.tagName,
+ classTarget: row.classList.contains('astryx-dropdown-menu-item'),
+ role: row.getAttribute('role'),
+ disabled: row.getAttribute('aria-disabled'),
+ variant: row.getAttribute('data-variant'),
+ size: row.getAttribute('data-size'),
+ href: row.getAttribute('href'),
+ tabIndex: row.getAttribute('tabindex'),
+ backgroundColor: style.backgroundColor,
+ color: style.color,
+ opacity: style.opacity,
+ outlineStyle: style.outlineStyle,
+ outlineColor: style.outlineColor,
+ geometry: {x: box.x, y: box.y, width: box.width, height: box.height},
+ };
+ };
+ return {
+ theme: document
+ .querySelector('[data-astryx-theme]')
+ ?.getAttribute('data-astryx-theme'),
+ mode: document.documentElement.getAttribute('data-theme'),
+ direction: getComputedStyle(currentRows[0]).direction,
+ viewport: {width: innerWidth, height: innerHeight},
+ reducedMotion: matchMedia('(prefers-reduced-motion: reduce)').matches,
+ horizontalOverflow:
+ document.documentElement.scrollWidth > innerWidth + 1,
+ fonts: document.fonts.status,
+ activeText: document.activeElement?.textContent
+ ?.replace(/\s+/g, ' ')
+ .trim(),
+ rows: currentRows.map(describe),
+ };
+ });
+
+ const semanticPass =
+ observed.rows.length === 5 &&
+ observed.rows.every(row => row?.role === 'menuitem' && row.classTarget) &&
+ observed.rows[2]?.variant === 'destructive' &&
+ observed.rows[3]?.disabled === 'true' &&
+ observed.rows[4]?.tagName === 'A' &&
+ observed.rows[4]?.href === '/settings' &&
+ observed.rows.every(
+ row =>
+ row !== null && row.geometry.width > 0 && row.geometry.height > 0,
+ );
+ const paintPass =
+ observed.rows[2]?.color !== observed.rows[0]?.color &&
+ Number(observed.rows[3]?.opacity ?? 1) < 1;
+ const interactionPaintPass =
+ item.interaction === 'rest' ||
+ (item.interaction === 'focus' &&
+ observed.rows[0]?.backgroundColor !==
+ observed.rows[1]?.backgroundColor) ||
+ (item.interaction === 'hover' &&
+ observed.rows[1]?.backgroundColor !==
+ observed.rows[0]?.backgroundColor);
+ const interactionPass =
+ (item.interaction !== 'focus' ||
+ observed.activeText?.includes('Edit project')) &&
+ interactionPaintPass;
+
+ const png = await page.screenshot({animations: 'disabled', fullPage: true});
+ const image = `${item.key}.png`;
+ const receipt = {
+ schemaVersion: 1,
+ expected: {
+ build: checkoutSha,
+ storyId: STORY_ID,
+ mode: item.mode,
+ direction: item.direction,
+ theme: item.theme,
+ interaction: item.interaction,
+ viewport: item.viewport,
+ },
+ observed: {build: storybookSha, ...observed, pageErrors},
+ image: {
+ file: image,
+ sha256: createHash('sha256').update(png).digest('hex'),
+ width: png.readUInt32BE(16),
+ height: png.readUInt32BE(20),
+ },
+ checks: {
+ semanticPass,
+ paintPass,
+ interactionPaintPass,
+ interactionPass,
+ },
+ passed:
+ storybookSha === checkoutSha &&
+ pageErrors.length === 0 &&
+ observed.theme === item.theme &&
+ observed.mode === item.mode &&
+ observed.direction === item.direction &&
+ observed.viewport.width === item.viewport.width &&
+ observed.viewport.height === item.viewport.height &&
+ observed.reducedMotion &&
+ !observed.horizontalOverflow &&
+ observed.fonts === 'loaded' &&
+ semanticPass &&
+ paintPass &&
+ interactionPass,
+ };
+ fs.writeFileSync(path.join(OUTPUT, image), png);
+ fs.writeFileSync(
+ path.join(OUTPUT, `${item.key}.sensors.json`),
+ `${JSON.stringify(receipt, null, 2)}\n`,
+ );
+ expect(receipt.passed).toBe(true);
+ await context.close();
+ });
+}
+
+test('manifest is complete', () => {
+ const receipts = fs
+ .readdirSync(OUTPUT)
+ .filter(file => file.endsWith('.sensors.json'));
+ fs.writeFileSync(
+ path.join(OUTPUT, 'manifest.json'),
+ `${JSON.stringify(
+ {
+ schemaVersion: 1,
+ component: 'core/DropdownMenuItem',
+ build: checkoutSha,
+ frames: cases.map(item => ({
+ key: item.key,
+ image: `${item.key}.png`,
+ receipt: `${item.key}.sensors.json`,
+ })),
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ expect(receipts).toHaveLength(cases.length);
+});