@astryxdesign/core 0.7.3-canary.d421aed → 0.7.3-canary.da1020b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +9 -5
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +2 -0
- package/package.json +3 -3
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +66 -7
- package/src/DropdownMenu/DropdownMenuItem.spec.md +209 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +62 -7
- package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +190 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +10 -4
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +93 -0
- package/src/DropdownMenu/__tests__/DropdownMenuItemAudit.a11y.chromium.spec.ts +366 -0
- package/src/DropdownMenu/__tests__/DropdownMenuRadioGroupAudit.a11y.chromium.spec.ts +327 -0
- package/src/Markdown/Markdown.helpers.perf.test.ts +25 -19
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* comes from the parent DropdownMenu's useListFocus, which matches
|
|
10
10
|
* menuitemradio rows.
|
|
11
11
|
*/
|
|
12
|
-
import { type ReactNode } from 'react';
|
|
12
|
+
import { type ReactNode, type Ref } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
14
|
export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'> {
|
|
15
15
|
/**
|
|
@@ -24,9 +24,9 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
24
24
|
/**
|
|
25
25
|
* Accessible name for the group, announced by screen readers so the radios
|
|
26
26
|
* read as a named set (e.g. "Sort by"). Applied as the group's `aria-label`.
|
|
27
|
-
* Required
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Required even when `aria-labelledby` (via base props) points to visible
|
|
28
|
+
* text; that visible reference becomes the computed name while `label`
|
|
29
|
+
* remains the fallback.
|
|
30
30
|
*/
|
|
31
31
|
label: string;
|
|
32
32
|
/**
|
|
@@ -36,6 +36,10 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
36
36
|
* @default true
|
|
37
37
|
*/
|
|
38
38
|
hasCloseOnSelect?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Ref forwarded to the role="group" root.
|
|
41
|
+
*/
|
|
42
|
+
ref?: Ref<HTMLDivElement>;
|
|
39
43
|
/**
|
|
40
44
|
* The `DropdownMenuRadioItem`s that make up the group.
|
|
41
45
|
*/
|
|
@@ -58,7 +62,7 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
58
62
|
* </DropdownMenu>
|
|
59
63
|
* ```
|
|
60
64
|
*/
|
|
61
|
-
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, xstyle, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
65
|
+
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, ref, xstyle, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
62
66
|
export declare namespace DropdownMenuRadioGroup {
|
|
63
67
|
var displayName: string;
|
|
64
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiB5C,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,SAAS,EACT,UAAU,CACX;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAuB,EACvB,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,+BAkB7B;yBA7Be,sBAAsB"}
|
|
@@ -51,6 +51,7 @@ export function DropdownMenuRadioGroup({
|
|
|
51
51
|
label,
|
|
52
52
|
hasCloseOnSelect = true,
|
|
53
53
|
children,
|
|
54
|
+
ref,
|
|
54
55
|
xstyle,
|
|
55
56
|
className,
|
|
56
57
|
style,
|
|
@@ -63,6 +64,7 @@ export function DropdownMenuRadioGroup({
|
|
|
63
64
|
}), [value, onChange, hasCloseOnSelect]);
|
|
64
65
|
return /*#__PURE__*/_jsx("div", {
|
|
65
66
|
...rest,
|
|
67
|
+
ref: ref,
|
|
66
68
|
role: "group",
|
|
67
69
|
"aria-label": label,
|
|
68
70
|
...mergeProps(stylex.props(styles.group, xstyle), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.3-canary.
|
|
3
|
+
"version": "0.7.3-canary.da1020b",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -792,8 +792,8 @@
|
|
|
792
792
|
"react-dom": ">=19.0.0"
|
|
793
793
|
},
|
|
794
794
|
"devDependencies": {
|
|
795
|
-
"@astryxdesign/a11y-spec": "0.7.3-canary.
|
|
796
|
-
"@astryxdesign/cli": "0.7.3-canary.
|
|
795
|
+
"@astryxdesign/a11y-spec": "0.7.3-canary.da1020b",
|
|
796
|
+
"@astryxdesign/cli": "0.7.3-canary.da1020b",
|
|
797
797
|
"@babel/cli": "^7.29.7",
|
|
798
798
|
"@babel/core": "^7.29.7",
|
|
799
799
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -8,7 +8,50 @@ export const docs = {
|
|
|
8
8
|
displayName: 'Dropdown Menu Item',
|
|
9
9
|
isHiddenFromOverview: true,
|
|
10
10
|
description:
|
|
11
|
-
'
|
|
11
|
+
'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.',
|
|
12
|
+
usage: {
|
|
13
|
+
description:
|
|
14
|
+
'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.',
|
|
15
|
+
bestPractices: [
|
|
16
|
+
{
|
|
17
|
+
guidance: true,
|
|
18
|
+
description:
|
|
19
|
+
'Use href for a destination so LinkProvider, modified clicks, middle clicks, and browser link affordances remain available.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
guidance: true,
|
|
23
|
+
description:
|
|
24
|
+
'Use hasCloseOnSelect=false only when activation reports a result in place on the same row.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
guidance: false,
|
|
28
|
+
description:
|
|
29
|
+
'Put buttons, links, or other focusable controls inside label, description, or endContent. Each menu row is one interactive target.',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
anatomy: [
|
|
33
|
+
{
|
|
34
|
+
name: 'Row',
|
|
35
|
+
required: true,
|
|
36
|
+
description:
|
|
37
|
+
'The role="menuitem" root that owns activation, disabled state, destination behavior, and theme state.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Content',
|
|
41
|
+
required: true,
|
|
42
|
+
description:
|
|
43
|
+
'The non-interactive label plus optional icon, description, and end content.',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
theming: {
|
|
48
|
+
targets: [
|
|
49
|
+
{
|
|
50
|
+
className: 'astryx-dropdown-menu-item',
|
|
51
|
+
visualProps: ['size', 'variant'],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
12
55
|
playground: {
|
|
13
56
|
// Standalone DropdownMenuItem has no required props, so the properties-tab
|
|
14
57
|
// preview renders an empty row without seeded content. Seed a label and
|
|
@@ -26,6 +69,7 @@ export const docs = {
|
|
|
26
69
|
name: 'label',
|
|
27
70
|
type: 'ReactNode',
|
|
28
71
|
description: 'Primary label text.',
|
|
72
|
+
required: true,
|
|
29
73
|
},
|
|
30
74
|
{
|
|
31
75
|
name: 'description',
|
|
@@ -55,11 +99,18 @@ export const docs = {
|
|
|
55
99
|
description:
|
|
56
100
|
'Link relationship. noopener noreferrer is added for target="_blank". Only used with href.',
|
|
57
101
|
},
|
|
102
|
+
{
|
|
103
|
+
name: 'isDisabled',
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
description:
|
|
106
|
+
'Whether the row is unavailable. Disabled rows expose aria-disabled, remove link destinations, and suppress activation.',
|
|
107
|
+
default: 'false',
|
|
108
|
+
},
|
|
58
109
|
{
|
|
59
110
|
name: 'endContent',
|
|
60
111
|
type: 'ReactNode',
|
|
61
112
|
description:
|
|
62
|
-
'
|
|
113
|
+
'Non-interactive content rendered after the label and description.',
|
|
63
114
|
},
|
|
64
115
|
{
|
|
65
116
|
name: 'hasCloseOnSelect',
|
|
@@ -95,7 +146,7 @@ export const docsZh = {
|
|
|
95
146
|
isHiddenFromOverview: true,
|
|
96
147
|
displayName: 'Dropdown Menu Item',
|
|
97
148
|
description:
|
|
98
|
-
'
|
|
149
|
+
'DropdownMenu 指针呈现中的一个操作或目标行。父菜单负责键盘导航;该行负责激活、禁用状态、目标行为、内容布局和主题目标。支持的宿主属性、DOM 处理程序、className、style、xstyle 和 ref 会落在或组合到 role="menuitem" 根元素上。',
|
|
99
150
|
props: [
|
|
100
151
|
{
|
|
101
152
|
name: 'icon',
|
|
@@ -106,6 +157,7 @@ export const docsZh = {
|
|
|
106
157
|
name: 'label',
|
|
107
158
|
type: 'ReactNode',
|
|
108
159
|
description: '主标签文本。',
|
|
160
|
+
required: true,
|
|
109
161
|
},
|
|
110
162
|
{
|
|
111
163
|
name: 'description',
|
|
@@ -134,10 +186,16 @@ export const docsZh = {
|
|
|
134
186
|
type: 'string',
|
|
135
187
|
description: '链接关系。target="_blank" 时自动加入 noopener noreferrer。',
|
|
136
188
|
},
|
|
189
|
+
{
|
|
190
|
+
name: 'isDisabled',
|
|
191
|
+
type: 'boolean',
|
|
192
|
+
description: '该行是否不可用;不可用的行不会激活或导航。',
|
|
193
|
+
default: 'false',
|
|
194
|
+
},
|
|
137
195
|
{
|
|
138
196
|
name: 'endContent',
|
|
139
197
|
type: 'ReactNode',
|
|
140
|
-
description: '
|
|
198
|
+
description: '在标签和描述之后渲染的非交互式附加内容。',
|
|
141
199
|
},
|
|
142
200
|
{
|
|
143
201
|
name: 'hasCloseOnSelect',
|
|
@@ -168,9 +226,9 @@ export const docsZh = {
|
|
|
168
226
|
|
|
169
227
|
export const docsDense = {
|
|
170
228
|
name: 'DropdownMenuItem',
|
|
171
|
-
isHiddenFromOverview: true,
|
|
172
229
|
displayName: 'Dropdown Menu Item',
|
|
173
|
-
description:
|
|
230
|
+
description:
|
|
231
|
+
'one pointer-menu action/destination row; parent owns keyboard, row owns activation, state, destination, content, and root inputs',
|
|
174
232
|
propDescriptions: {
|
|
175
233
|
icon: 'icon before label',
|
|
176
234
|
label: 'primary label text',
|
|
@@ -180,7 +238,8 @@ export const docsDense = {
|
|
|
180
238
|
href: 'row is a real anchor w/ role=menuitem; modified/middle click keeps browser meaning',
|
|
181
239
|
target: "link target ('_blank' | '_self'), with href",
|
|
182
240
|
rel: 'link rel; noopener noreferrer added for _blank',
|
|
183
|
-
|
|
241
|
+
isDisabled: 'unavailable; removes destinations and suppresses activation',
|
|
242
|
+
endContent: 'non-interactive content after label+description',
|
|
184
243
|
hasCloseOnSelect:
|
|
185
244
|
'false keeps the menu open on activation (in-place result on the item)',
|
|
186
245
|
variant:
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 3
|
|
3
|
+
template_version: 7
|
|
4
|
+
kind: component
|
|
5
|
+
id: component:DropdownMenuItem
|
|
6
|
+
authority: draft
|
|
7
|
+
archive_reason: null
|
|
8
|
+
superseded_by: null
|
|
9
|
+
approved_by: null
|
|
10
|
+
approved_at: null
|
|
11
|
+
owners: [cixzhang]
|
|
12
|
+
review_triggers: [public-api, behavior, accessibility, theming, testing]
|
|
13
|
+
verified_by:
|
|
14
|
+
[
|
|
15
|
+
packages/core/src/DropdownMenu/DropdownMenu.test.tsx,
|
|
16
|
+
packages/core/src/DropdownMenu/__tests__/Menu.a11y.test.tsx,
|
|
17
|
+
packages/core/src/theme/themingTargets.test.ts,
|
|
18
|
+
apps/storybook/stories/DropdownMenuItem.stories.tsx,
|
|
19
|
+
apps/storybook/rtl-audit/verified-not-applicable.json,
|
|
20
|
+
scripts/check-knowledge.mjs,
|
|
21
|
+
]
|
|
22
|
+
modules: []
|
|
23
|
+
families: [family:navigation-destinations]
|
|
24
|
+
design_specs: []
|
|
25
|
+
architecture:
|
|
26
|
+
[
|
|
27
|
+
architecture:public-component-api,
|
|
28
|
+
architecture:component-theming-surface,
|
|
29
|
+
architecture:component-test-sufficiency,
|
|
30
|
+
architecture:interaction-modality,
|
|
31
|
+
]
|
|
32
|
+
contributing: []
|
|
33
|
+
system_specs: [spec:AST-020, spec:AST-029]
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# DropdownMenuItem component contract
|
|
37
|
+
|
|
38
|
+
## Contract at a glance
|
|
39
|
+
|
|
40
|
+
| Area | Contract |
|
|
41
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| 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. |
|
|
43
|
+
| 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. |
|
|
44
|
+
| End-user impact | Actions and destinations preserve keyboard, pointer, and browser link behavior while unavailable rows remain inert and destructive actions remain identifiable. |
|
|
45
|
+
| Builder impact | Destinations use `href`; supporting content stays non-interactive; `hasCloseOnSelect=false` is reserved for in-place result feedback. |
|
|
46
|
+
| Compatibility/readiness | Patch-compatible observational contract. Runtime, exports, defaults, and theme targets remain unchanged; authority stays `draft` until exact-head owner approval. |
|
|
47
|
+
| 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. |
|
|
48
|
+
| 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`. |
|
|
49
|
+
|
|
50
|
+
This table is a review projection; the body below is authoritative.
|
|
51
|
+
|
|
52
|
+
## Intent
|
|
53
|
+
|
|
54
|
+
DropdownMenuItem renders one compound-mode row in the pointer presentation of
|
|
55
|
+
DropdownMenu. It owns the row element, content slots, action-versus-destination
|
|
56
|
+
branch, activation order, disabled and destructive state, root composition, and
|
|
57
|
+
`dropdown-menu-item` theme target. DropdownMenu owns the surrounding menu,
|
|
58
|
+
keyboard collection, focus movement, typeahead, presentation choice, and close
|
|
59
|
+
lifecycle.
|
|
60
|
+
|
|
61
|
+
## Compatibility and migration
|
|
62
|
+
|
|
63
|
+
- Released default preserved: yes.
|
|
64
|
+
- Compatibility class: observational patch; no behavior or public surface changes.
|
|
65
|
+
- Controlled/uncontrolled behavior: not applicable.
|
|
66
|
+
- Migration decision: none.
|
|
67
|
+
|
|
68
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
69
|
+
|
|
70
|
+
## Ownership boundary
|
|
71
|
+
|
|
72
|
+
**Owns**
|
|
73
|
+
|
|
74
|
+
- One `role="menuitem"` root and its label, description, icon, end content,
|
|
75
|
+
disabled state, destructive variant, ref, supported host inputs, and styling inputs.
|
|
76
|
+
- Action callback order and `hasCloseOnSelect` behavior.
|
|
77
|
+
- Link-row rendering, destination handoff, modified/middle-click preservation,
|
|
78
|
+
target and relationship handling, and disabled-link inertness.
|
|
79
|
+
- Pointer hover focus and the row's press/hover/focus paint.
|
|
80
|
+
- The `dropdown-menu-item` target and its size/variant state reflection.
|
|
81
|
+
|
|
82
|
+
**Does not own / non-goals**
|
|
83
|
+
|
|
84
|
+
- Menu naming, open/close state, focus entry, roving focus, typeahead, and keyboard
|
|
85
|
+
click synthesis — owned by DropdownMenu and its shared hooks.
|
|
86
|
+
- Touch and bottom-sheet row rendering — the parent presentation delegates those
|
|
87
|
+
rows to List.
|
|
88
|
+
- Destination acceptance and blocking — owned by `family:navigation-destinations`.
|
|
89
|
+
- Interactive controls inside label, description, or end content. Controls belong
|
|
90
|
+
beside the menu or as separate rows.
|
|
91
|
+
|
|
92
|
+
## Public concepts
|
|
93
|
+
|
|
94
|
+
| Concept | Closed values or states | Meaning | Availability | Default | Owner | Stability | Invalid-value behavior |
|
|
95
|
+
| ------------ | --------------------------------------------------- | ------------------------------------------------------------------------------ | --------------------------- | ------- | ------------------------------- | --------- | ------------------------------------------------------------ |
|
|
96
|
+
| 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. |
|
|
97
|
+
| 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. |
|
|
98
|
+
| Close policy | close; remain open | Whether successful activation closes the parent menu. | Action and destination rows | close | component | stable | Omission closes. |
|
|
99
|
+
| 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. |
|
|
100
|
+
| 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. |
|
|
101
|
+
|
|
102
|
+
## Behavioral and layout contract
|
|
103
|
+
|
|
104
|
+
Draft requirements identify their basis so observed code is not mistaken for an
|
|
105
|
+
intentional decision.
|
|
106
|
+
|
|
107
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
108
|
+
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
109
|
+
| 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 |
|
|
110
|
+
| 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 |
|
|
111
|
+
| 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 |
|
|
112
|
+
| 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 |
|
|
113
|
+
| 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 |
|
|
114
|
+
| 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 |
|
|
115
|
+
| 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 |
|
|
116
|
+
| 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 |
|
|
117
|
+
|
|
118
|
+
### Allowed variation
|
|
119
|
+
|
|
120
|
+
- **AV1 — Content.** Non-interactive icons, text, descriptions, shortcuts, badges,
|
|
121
|
+
and status text may vary without changing the row's menuitem semantics.
|
|
122
|
+
- **AV2 — Theme paint.** A theme may restyle the target's admitted properties while
|
|
123
|
+
preserving visible state distinctions and forced-colors focus.
|
|
124
|
+
- **AV3 — Parent size.** The parent menu supplies `sm`, `md`, or `lg`; the row reflects
|
|
125
|
+
that state and may vary its tokenized insets.
|
|
126
|
+
|
|
127
|
+
### Representative states
|
|
128
|
+
|
|
129
|
+
| State | Required invariant | Allowed variation |
|
|
130
|
+
| ---------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
131
|
+
| Enabled action | Callback runs, then close follows the close policy. | Content, size, and visual variant. |
|
|
132
|
+
| In-place result action | Callback runs and the menu remains open. | Label/end content may update. |
|
|
133
|
+
| Disabled action | `aria-disabled=true`; callback, hover focus, and close are suppressed. | Content remains visible. |
|
|
134
|
+
| Destination | One anchor root preserves safe destination and browser activation behavior. | Target, rel, router provider, and content. |
|
|
135
|
+
| Destructive | Error-role paint applies to label, icon, and description without changing behavior. | Other row content remains consumer-authored. |
|
|
136
|
+
| Keyboard focus | Parent focus lands on the row and remains visible. | Exact theme-owned paint may vary. |
|
|
137
|
+
| RTL / narrow viewport | Logical insets and start alignment follow direction without horizontal overflow. | Menu placement remains parent-owned. |
|
|
138
|
+
|
|
139
|
+
### Transformation and precedence order
|
|
140
|
+
|
|
141
|
+
- **ORD1 — Activation.** Disabled guard → browser-navigation classification → row
|
|
142
|
+
callback where applicable → close policy → browser/router navigation.
|
|
143
|
+
- **ORD2 — Root composition.** Parent size → base row styles → variant/disabled state
|
|
144
|
+
→ caller `xstyle`; target metadata and caller class/style compose on the same root.
|
|
145
|
+
|
|
146
|
+
### Performance and resources
|
|
147
|
+
|
|
148
|
+
- **PR1 — Shared press lifecycle.** DropdownMenuItem uses the shared counted press
|
|
149
|
+
controller through `usePressFeedback`; the first mounted pressable installs the
|
|
150
|
+
window listeners and the last removes them. The item adds no per-row listener,
|
|
151
|
+
observer, timer, request, or local resource owner.
|
|
152
|
+
|
|
153
|
+
## Accessibility contract
|
|
154
|
+
|
|
155
|
+
- **AR1 — Menu item semantics.** The root is one named `menuitem`; supporting content
|
|
156
|
+
does not introduce a nested interactive descendant.
|
|
157
|
+
- **AR2 — Disabled state.** Disabled rows expose state and cannot activate or navigate.
|
|
158
|
+
- **AR3 — Keyboard ownership.** DropdownMenu owns focus collection and activation;
|
|
159
|
+
the item remains a single row in that model.
|
|
160
|
+
- **AR4 — Focus perception.** Focus remains visually perceivable in supported themes
|
|
161
|
+
and platform accessibility modes; the open forced-colors gap remains explicit.
|
|
162
|
+
|
|
163
|
+
## Design relationships
|
|
164
|
+
|
|
165
|
+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
|
|
166
|
+
| ---------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -------------- | ------------------ |
|
|
167
|
+
| Row | One full-width action/destination target with tokenized insets and start alignment. | Current source and parent menu composition | prominent | FR1–FR6 |
|
|
168
|
+
| Supporting text | Description and end content remain subordinate to the row label. | Delegated Item layout and current consumer docs | supporting | FR1 |
|
|
169
|
+
| Interaction | Hover, focus, press, disabled, and destructive states remain distinguishable. | Current source; forced-colors focus is an unresolved objective gap | prominent | FR5, FR8, AR4 |
|
|
170
|
+
|
|
171
|
+
No new component-local visual decision is settled by this draft.
|
|
172
|
+
|
|
173
|
+
## Family and system relationships
|
|
174
|
+
|
|
175
|
+
- `family:navigation-destinations` owns destination acceptance and blocked-scheme
|
|
176
|
+
behavior; this component supplies the destination-bearing row.
|
|
177
|
+
- `architecture:public-component-api` owns root input composition, refs, and released
|
|
178
|
+
compatibility.
|
|
179
|
+
- `architecture:component-theming-surface` owns target placement and state reflection.
|
|
180
|
+
- `architecture:component-test-sufficiency` owns proportionate observable evidence.
|
|
181
|
+
- `architecture:interaction-modality` and DropdownMenu own parent keyboard behavior.
|
|
182
|
+
- `spec:AST-020` supplies WCAG/APG adoption and evidence-layer boundaries.
|
|
183
|
+
- `spec:AST-029` keeps this observational draft separate from the audit receipt.
|
|
184
|
+
|
|
185
|
+
## Verification map
|
|
186
|
+
|
|
187
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
188
|
+
| ---------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
|
|
189
|
+
| 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` |
|
|
190
|
+
| 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` |
|
|
191
|
+
| 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` |
|
|
192
|
+
| 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` |
|
|
193
|
+
|
|
194
|
+
## Decision log
|
|
195
|
+
|
|
196
|
+
None. This draft records current facts and introduces no product decision.
|
|
197
|
+
|
|
198
|
+
## Open questions
|
|
199
|
+
|
|
200
|
+
- **OQ1 — Which shared keyboard owner should keep disabled menu items discoverable
|
|
201
|
+
while preserving their inert behavior?** (`human-api`)
|
|
202
|
+
- **OQ2 — Should forced-colors focus use a component-specific system outline, or a
|
|
203
|
+
shared row-focus treatment that also governs ordinary themes?** (`human-design`)
|
|
204
|
+
|
|
205
|
+
## Content boundary
|
|
206
|
+
|
|
207
|
+
This file does not duplicate consumer prop tables/examples, current audit scores,
|
|
208
|
+
screenshot matrices, implementation steps, or family/system rules. The audit pull
|
|
209
|
+
request owns the closed run evidence required by `spec:AST-029/FR5`.
|
|
@@ -8,7 +8,52 @@ export const docs = {
|
|
|
8
8
|
displayName: 'Dropdown Menu Radio Group',
|
|
9
9
|
isHiddenFromOverview: true,
|
|
10
10
|
description:
|
|
11
|
-
'A single-select group of
|
|
11
|
+
'A controlled, named single-select group of DropdownMenuRadioItem children (role="group" of menuitemradio). Owns value propagation, close policy, root composition, and the menu inter-item gap; the parent DropdownMenu owns keyboard navigation.',
|
|
12
|
+
usage: {
|
|
13
|
+
description:
|
|
14
|
+
'Use DropdownMenuRadioGroup inside compound-mode DropdownMenu when several commands represent one mutually exclusive choice. Keep value in caller state, provide a concise accessible label, and render each choice as DropdownMenuRadioItem.',
|
|
15
|
+
bestPractices: [
|
|
16
|
+
{
|
|
17
|
+
guidance: true,
|
|
18
|
+
description:
|
|
19
|
+
'Keep value controlled and update it from onChange so checked state follows caller data.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
guidance: true,
|
|
23
|
+
description:
|
|
24
|
+
'Provide a concise label even when aria-labelledby points to visible text; label remains required and supplies the aria-label fallback.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
guidance: true,
|
|
28
|
+
description:
|
|
29
|
+
'Set hasCloseOnSelect=false only when the menu must stay open to show another selection or an in-place result.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
guidance: false,
|
|
33
|
+
description:
|
|
34
|
+
'Place buttons, links, checkboxes, or arbitrary menu rows inside the radio group.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
guidance: false,
|
|
38
|
+
description:
|
|
39
|
+
'Add a second key handler or roving-focus model; DropdownMenu owns keyboard navigation.',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
anatomy: [
|
|
43
|
+
{
|
|
44
|
+
name: 'Group',
|
|
45
|
+
required: true,
|
|
46
|
+
description:
|
|
47
|
+
'The role="group" root that owns the accessible name, controlled-selection context, close policy, root inputs, and inter-item gap.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Radio items',
|
|
51
|
+
required: true,
|
|
52
|
+
description:
|
|
53
|
+
'DropdownMenuRadioItem children; each child owns its menuitemradio role, checked state, content, and indicator paint.',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
12
57
|
playground: {
|
|
13
58
|
wrapper: {
|
|
14
59
|
component: 'DropdownMenu',
|
|
@@ -42,17 +87,20 @@ export const docs = {
|
|
|
42
87
|
type: 'string | undefined',
|
|
43
88
|
description:
|
|
44
89
|
'The currently selected value in the group. Pass undefined when nothing is selected yet.',
|
|
90
|
+
required: true,
|
|
45
91
|
},
|
|
46
92
|
{
|
|
47
93
|
name: 'onChange',
|
|
48
94
|
type: '(value: string) => void',
|
|
49
95
|
description: 'Callback fired when the selected value changes.',
|
|
96
|
+
required: true,
|
|
50
97
|
},
|
|
51
98
|
{
|
|
52
99
|
name: 'label',
|
|
53
100
|
type: 'string',
|
|
54
101
|
description:
|
|
55
|
-
'Accessible name for the group, applied as aria-label so screen readers announce the radios as a named set, e.g. "Sort by". Required
|
|
102
|
+
'Accessible name for the group, applied as aria-label so screen readers announce the radios as a named set, e.g. "Sort by". Required even when aria-labelledby (via base props) points to visible text; that visible reference becomes the computed name while label remains the fallback.',
|
|
103
|
+
required: true,
|
|
56
104
|
},
|
|
57
105
|
{
|
|
58
106
|
name: 'hasCloseOnSelect',
|
|
@@ -61,40 +109,47 @@ export const docs = {
|
|
|
61
109
|
description:
|
|
62
110
|
'Whether selecting a value closes the menu. Radio items default to closing on selection (a single-choice commit).',
|
|
63
111
|
},
|
|
112
|
+
{
|
|
113
|
+
name: 'ref',
|
|
114
|
+
type: 'React.Ref<HTMLDivElement>',
|
|
115
|
+
description: 'Ref forwarded to the role="group" root.',
|
|
116
|
+
},
|
|
64
117
|
{
|
|
65
118
|
name: 'children',
|
|
66
119
|
type: 'ReactNode',
|
|
67
120
|
description: 'The DropdownMenuRadioItems that make up the group.',
|
|
121
|
+
required: true,
|
|
68
122
|
},
|
|
69
123
|
],
|
|
70
124
|
};
|
|
71
125
|
|
|
72
126
|
export const docsZh = {
|
|
73
127
|
name: 'DropdownMenuRadioGroup',
|
|
74
|
-
isHiddenFromOverview: true,
|
|
75
128
|
displayName: 'Dropdown Menu Radio Group',
|
|
76
129
|
description:
|
|
77
|
-
'
|
|
130
|
+
'DropdownMenu 中由调用方控制且有名称的单选组(menuitemradio 的 role="group")。该组负责值传递、关闭策略、根元素组合和菜单项间距;父 DropdownMenu 负责键盘导航。',
|
|
78
131
|
propDescriptions: {
|
|
79
132
|
value: '组中当前选中的值。尚无选中项时传 undefined。',
|
|
80
133
|
onChange: '所选值变化时触发的回调。',
|
|
81
134
|
label:
|
|
82
|
-
'组的无障碍名称,作为 aria-label
|
|
135
|
+
'组的无障碍名称,作为 aria-label 应用。即使 aria-labelledby(通过基础属性)指向可见文本,label 仍然必需并作为后备名称。',
|
|
83
136
|
hasCloseOnSelect: '选择某值是否关闭菜单。默认关闭。',
|
|
137
|
+
ref: '转发到 role="group" 根元素的 ref。',
|
|
84
138
|
children: '组成该组的 DropdownMenuRadioItem。',
|
|
85
139
|
},
|
|
86
140
|
};
|
|
87
141
|
|
|
88
142
|
export const docsDense = {
|
|
89
143
|
name: 'DropdownMenuRadioGroup',
|
|
90
|
-
isHiddenFromOverview: true,
|
|
91
144
|
displayName: 'Dropdown Menu Radio Group',
|
|
92
|
-
description:
|
|
145
|
+
description:
|
|
146
|
+
'controlled named menuitemradio group; owns value propagation, close policy, root inputs, and item gap',
|
|
93
147
|
propDescriptions: {
|
|
94
148
|
value: 'selected value (undefined = none)',
|
|
95
149
|
onChange: 'fired when selected value changes',
|
|
96
150
|
label: 'accessible group name (applied as aria-label); required',
|
|
97
151
|
hasCloseOnSelect: 'close menu on select (default true)',
|
|
152
|
+
ref: 'forwarded to the role="group" root',
|
|
98
153
|
children: 'the DropdownMenuRadioItems',
|
|
99
154
|
},
|
|
100
155
|
};
|