dequelabs / dequelabs/axe-core
aria-required-parent false positive for native <option role="option"> inside <select>
- Dominant language
- JavaScript
- Stars
- 7.5k
- Forks
- 933
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 17
Description
### Product
axe-core
### Product Version
4.12.1
### Latest Version
- [x] I have tested the issue with the latest version of the product
### Issue Description
## Expectation
Native `` elements inside a native `` should not fail aria-required-parent, even when they include an explicit `role="option"`.
Browsers already expose options through the native control’s accessibility tree (combobox with internal/slotted listbox ownership). The required parent context for option is provided by the UA, not by a DOM ancestor with `role="listbox"` or `role="group"`.
## Actual
axe reports aria-required-parent (critical) on each `` inside a single-select ``.
Axe maps single-select `` to implicit role combobox, then treats explicit `role="option"` as requiring a DOM parent of listbox or group. Walking the DOM parent chain finds combobox, so the rule fails.
Removing the redundant `role="option"` attributes makes the violation disappear, which shows the failure is driven by the explicit role + DOM walk, not by a real missing listbox relationship in the accessibility tree.
## How to Reproduce
Fails:
```
Current
Previous
```
Result with axe-core 4.12.1: 2 × aria-required-parent on the nodes, required parents reported as group, listbox.
Passes (same markup without explicit roles):
```
Current
Previous
```
Result: no aria-required-parent violations.
## Additional context
* Explicit `role="option"` on native `` is redundant / generally invalid authoring (allowedRoles: false), but classifying it as a missing required parent is still a false positive for native ``.
* Suggested fix: skip aria-required-parent for `` / `` when owned by a native ``, or treat native `` as providing the required listbox context for its options.
* The rule should continue to catch orphan custom `role="option"` widgets that are not inside a real listbox / group.
Contributor guide
Research direction
Start with the aria-required-parent rule and reproduce the issue using the native select and option markup in the report. Trace how the rule walks parent roles for an option with an explicit role, then add coverage for native select options while preserving checks for orphan custom option widgets. Done means the reported native options pass without suppressing genuine missing-parent violations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- accessibility
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100