Skip to content

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

TypeScript

test(DropdownMenu): radio-item and sub-menu audits expect a disabled row in the roving order (#10622)

Cindy Zhangc99ad4aa2092
diff --git a/packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts b/packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts
index d6c194546f..0de27529c2 100644
--- a/packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts
+++ b/packages/core/src/DropdownMenu/__tests__/DropdownMenuRadioItemAudit.a11y.chromium.spec.ts
@@ -216,6 +216,18 @@ for (const item of cases) {
await row('List').click();
await expect(row('List')).toHaveAttribute('aria-checked', 'true');
} else if (item.interaction === 'disabled-hover') {
+ // The disabled row is inert: a click, Enter and Space neither check it
+ // nor reach the consumer's handler (the `checked` and
+ // `consumerHandlers` checks). ArrowUp then moves focus off it.
+ const box = await row('Archive').boundingBox();
+ if (box == null) {
+ throw new Error('the disabled row has no box');
+ }
+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
+ await row('Archive').focus();
+ await page.keyboard.press('Enter');
+ await page.keyboard.press(' ');
+ await page.keyboard.press('ArrowUp');
await row('Archive').hover();
}
await settle(page);
@@ -458,9 +470,10 @@ for (const item of cases) {
rows: observed.rows.length === 5,
checked:
checked.length === 1 && checked[0].startsWith(expectedChecked(item)),
+ // A disabled row stays in the roving order, so the arrow keys reach it.
disabledRow:
observed.rows[4]?.disabled === 'true' &&
- observed.rows[4]?.tabIndex === null,
+ observed.rows[4]?.tabIndex === '-1',
activeRow:
active === undefined
? true
diff --git a/packages/core/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts b/packages/core/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts
index 8dc528a753..f8b8280c0f 100644
--- a/packages/core/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts
+++ b/packages/core/src/DropdownMenu/__tests__/DropdownMenuSubMenuAudit.a11y.chromium.spec.ts
@@ -279,7 +279,20 @@ for (const item of cases) {
await expect(flyout).toBeVisible();
await page.mouse.down();
} else if (item.interaction === 'disabled-hover') {
- await row(menu, 'Archive').hover();
+ // The disabled trigger is inert: a click, Enter, Space and the open key
+ // leave it collapsed (the `rowStates` check) and pick nothing (the
+ // `counters` check).
+ const archive = row(menu, 'Archive');
+ const box = await archive.boundingBox();
+ if (box == null) {
+ throw new Error('the disabled row has no box');
+ }
+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
+ await archive.focus();
+ await page.keyboard.press('Enter');
+ await page.keyboard.press(' ');
+ await page.keyboard.press(openKey);
+ await archive.hover();
await page.waitForTimeout(600);
} else if (item.interaction === 'drill-in') {
await subject.click();
@@ -607,7 +620,8 @@ for (const item of cases) {
item.interaction === 'select' ||
item.interaction === 'drill-in' ||
(findRow('Archive')?.disabled === 'true' &&
- findRow('Archive')?.tabIndex === null &&
+ findRow('Archive')?.tabIndex === '-1' &&
+ findRow('Archive')?.expanded === 'false' &&
findRow('Export')?.spinnerHidden === true &&
findRow('Share')?.haspopup === 'menu'),
indicatorMirror: