dequelabs / dequelabs/axe-core

aria-required-parent/children does not respect intermediate group role for list/listitem

Open
#4,879 1 comment 0 reactions 0 assignees View on GitHub
info needed
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

### Product

axe-core

### Product Version

4.10.3

### Latest Version

- [x] I have tested the issue with the latest version of the product

### Issue Description

#### Expectation
I have the following DOM structure (redacted/simplified):

```html




List




list-item


list-item



```

[Per the ARIA spec](https://www.w3.org/TR/wai-aria-1.1/#listitem), the `list` > `group` > `listitem` structure is valid (`fieldset` has the implicit role of `group`).

#### Actual
After upgrading from `4.8.2` to `4.10.3`, I started getting required parent/children warnings (running via jest-axe):
```
Expected the HTML [...] to have no violations:

Received:
"Certain ARIA roles must contain particular children (aria-required-children)"

Fix any of the following:
Element has children which are not allowed: [role=group]

────────

Expected the HTML [...] to have no violations:

list-item

Received:
"Certain ARIA roles must be contained by particular parents (aria-required-parent)"

Fix any of the following:
Required ARIA parent role not present: list
```

Adding an explicit group role on the fieldset does not fix it (as expected given the first error indicating that it correctly identifies the implicit role). Moving the list role to the fieldset does fix the warning, though that was only for debugging the library and is undesirable for many reasons.

#### How to Reproduce
Can see the violations logged to the console in this fiddle: https://jsfiddle.net/b3x2npm8/

#### Additional context
n/a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.