dequelabs / dequelabs/axe-core

# Bug: `aria-required-children` incorrectly flags WAI-ARIA 1.2 `table` example with `caption`

Open
#5,265 1 comment 0 reactions 0 assignees View on GitHub
fix rules
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

### Product

axe Extension

### Product Version

4.12.1

### Latest Version

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

### Issue Description

## Expected Behavior

The following example should not trigger an `aria-required-children` violation.

The markup is taken directly from the WAI-ARIA 1.2 specification for the `caption` role:

https://www.w3.org/TR/wai-aria-1.2/#caption

The `table` contains the required `rowgroup`, `row`, `columnheader`, and `cell` roles, and also includes a `caption` as shown in the specification.

## Actual Behavior

axe-core reports an `aria-required-children` violation on the element with `role="table"`.

We first encountered this while investigating a customer-reported accessibility issue. To verify whether the issue was specific to our implementation, we recreated the example directly from the WAI-ARIA specification. The same violation was reported.

## Reproduction

1. Create a page containing the following markup.
2. Run axe DevTools or axe-core.
3. Observe that `aria-required-children` reports a violation on the `role="table"` element.

```html



Contest Entrants

This table shows the total number of entrants.



Contestant
Score



Fred
10


Wilma
8



Does this issue happen with every page?
No.
The issue appears when a role="table" contains a role="caption" as demonstrated in the WAI-ARIA 1.2 specification.
Additional Information
Based on the WAI-ARIA 1.2 specification, caption appears to be a valid structural component of an ARIA table. Because the example above is copied directly from the specification, we expected it to pass the aria-required-children rule.
If this behavior is intentional, clarification on how the specification example should be interpreted would be appreciated. Otherwise, this appears to be a potential false positive in the aria-required-children rule.
z
Image

Contributor guide

Open the contributing guide

Research direction

Start with the aria-required-children rule and reproduce the provided WAI-ARIA 1.2 table and caption markup in axe-core. Trace why role="caption" is reported under role="table", then add coverage showing the specification example is accepted and verify that the violation no longer occurs.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.