Skip to content

Commit 74ffe0c

Browse files
committed
udpate: add missing menuitemradio and menutitemcheckbox roles
1 parent 931fc73 commit 74ffe0c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/oxc_linter/src/rules/jsx_a11y/role_has_required_aria_props.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ declare_oxc_lint!(
4747
static ROLE_TO_REQUIRED_ARIA_PROPS: phf::Map<&'static str, phf::Set<&'static str>> = phf_map! {
4848
"checkbox" => phf_set!{"aria-checked"},
4949
"radio" => phf_set!{"aria-checked"},
50+
"menuitemcheckbox" => phf_set!{"aria-checked"},
51+
"menuitemradio" => phf_set!{"aria-checked"},
5052
"combobox" => phf_set!{"aria-controls", "aria-expanded"},
5153
"tab" => phf_set!{"aria-selected"},
5254
"slider" => phf_set!{"aria-valuemax", "aria-valuemin", "aria-valuenow"},
@@ -121,6 +123,8 @@ fn test() {
121123
None,
122124
Some(settings()),
123125
),
126+
("<div role='menuitemradio' aria-checked='false' />", None, None),
127+
("<div role='menuitemcheckbox' aria-checked='false' />", None, None),
124128
];
125129

126130
let fail = vec![
@@ -141,6 +145,8 @@ fn test() {
141145
("<div role='scrollbar' aria-valuemin aria-valuenow />", None, None),
142146
("<div role='heading' />", None, None),
143147
("<div role='option' />", None, None),
148+
("<div role='menuitemradio' />", None, None),
149+
("<div role='menuitemcheckbox' />", None, None),
144150
("<MyComponent role='combobox' />", None, Some(settings())),
145151
];
146152

crates/oxc_linter/src/snapshots/jsx_a11y_role_has_required_aria_props.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,20 @@ source: crates/oxc_linter/src/tester.rs
253253
╰────
254254
help: Add missing aria props `aria-selected` to the element with `option` role.
255255

256+
eslint-plugin-jsx-a11y(role-has-required-aria-props): `menuitemradio` role is missing required aria props `aria-checked`.
257+
╭─[role_has_required_aria_props.tsx:1:6]
258+
1<div role='menuitemradio' />
259+
· ────────────────────
260+
╰────
261+
help: Add missing aria props `aria-checked` to the element with `menuitemradio` role.
262+
263+
eslint-plugin-jsx-a11y(role-has-required-aria-props): `menuitemcheckbox` role is missing required aria props `aria-checked`.
264+
╭─[role_has_required_aria_props.tsx:1:6]
265+
1<div role='menuitemcheckbox' />
266+
· ───────────────────────
267+
╰────
268+
help: Add missing aria props `aria-checked` to the element with `menuitemcheckbox` role.
269+
256270
eslint-plugin-jsx-a11y(role-has-required-aria-props): `combobox` role is missing required aria props `aria-controls`.
257271
╭─[role_has_required_aria_props.tsx:1:14]
258272
1<MyComponent role='combobox' />

0 commit comments

Comments
 (0)