diff --git a/e2e/matchers/toHaveNoViolations.ts b/e2e/matchers/toHaveNoViolations.ts index e4d48c6cfef..d1ca4decfbf 100644 --- a/e2e/matchers/toHaveNoViolations.ts +++ b/e2e/matchers/toHaveNoViolations.ts @@ -44,13 +44,73 @@ expect.extend({ // @ts-ignore `axe` is a global variable defined by page.evaluate() above const axe = window.axe + const interactiveElements = ['a[href]', 'button', 'summary', 'select', 'input:not([type=hidden])', 'textarea'] + const focusableElements = interactiveElements.concat(['[tabindex]']) + axe.configure({ rules: [ + { + id: 'menuitem-should-be-interactive', + excludeHidden: true, + selector: + 'div[role="menuitem"], span[role="menuitem"], div[role="menuitemradio"], span[role="menuitemradio"], div[role="menuitemcheckbox"], span[role="menuitemcheckbox"]', + all: ['menuitem-should-be-interactive_0'], + any: [], + metadata: { + help: 'Menu items must be focusable. Use