Skip to content

Commit f851e04

Browse files
author
Adrián Bolonio
authored
Update deprecated/ActionList axe test
1 parent 94b7ef0 commit f851e04

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/SelectPanel/SelectPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export function SelectPanel({
210210
open={open}
211211
onOpen={onOpen}
212212
onClose={onClose}
213-
overlayProps={{...overlayProps, onKeyPress: overlayKeyPressHandler, role: 'dialog'}}
213+
overlayProps={{...overlayProps, onKeyPress: overlayKeyPressHandler, role: 'dialog', 'aria-labelledby': titleId}}
214214
focusTrapSettings={focusTrapSettings}
215215
focusZoneSettings={focusZoneSettings}
216216
>

src/__tests__/deprecated/ActionList.test.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,24 @@ describe('ActionList', () => {
4242

4343
it('should have no axe violations', async () => {
4444
const {container} = HTMLRender(<SimpleActionList />)
45-
const results = await axe(container)
45+
/**
46+
* Axe is throwing an issue because there are <ul role="listbox"> without <li role="option"> as direct children
47+
* This is because we have a group structure inside the listbox:
48+
* <ul role="listbox">
49+
* <li role="presentation">
50+
* <ul role="group">
51+
* <li role="option">Option 1</li>
52+
* </ul>
53+
* </li>
54+
* </ul>
55+
* We have consulted and agreed with our a11y consultant (@jscholes) about this solution.
56+
*/
57+
const results = await axe(container, {
58+
rules: {
59+
'aria-required-parent': {enabled: false},
60+
'aria-required-children': {enabled: false}
61+
}
62+
})
4663
expect(results).toHaveNoViolations()
4764
cleanup()
4865
})

0 commit comments

Comments
 (0)