Pivot Table v2: span[role=columnheader] has no row parent (axe aria-required-parent)
Bug description
On a dashboard that contains a Pivot Table (v2) chart, axe-core reports the critical rule aria-required-parent on every column header: the header cells render an inner <span role="columnheader" tabindex="0"> whose parent is a <th>, not an element with role="row", so the required ARIA parent is missing.
Example element reported by axe-core 4.12.1:
<th class="pvtColLabel" colspan="1" rowspan="2">
<span role="columnheader" tabindex="0">...</span>
</th>
axe-core message: "Required ARIA parent role not present: row".
A single pivot table with a few dozen columns produces dozens of nodes, so one dashboard can show several hundred.
How to reproduce the bug
- Create a Pivot Table (v2) chart on any dataset with at least one column in "Columns" (so the table has column headers).
- Add the chart to a dashboard and open the dashboard.
- Run axe-core (for example the axe DevTools browser extension, or
@axe-core/playwrightwith the tagswcag2a,wcag2aa,wcag21a,wcag21aa). - Look at the
aria-required-parentresult: one node perspan[role="columnheader"]inside the pivot table.
Expected results
No aria-required-parent violation. Either the inner span carries no role="columnheader" (the surrounding <th> already exposes that role), or it sits inside an element with role="row".
Actual results
Critical aria-required-parent violation on every column header of the pivot table.
Screenshots/recordings
No response
Superset version
6.1.0
Python version
3.10
Node version
Not applicable (official apache/superset:6.1.0 image).
Browser
Chrome
Additional context
axe-core rule id: aria-required-parent (impact: critical). Found while running an automated accessibility check over a set of dashboards; the check is repeatable on any dashboard with a pivot table.
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for debugging information.
Hi! I'd like to work on fixing this aria-required-parent issue on the Pivot Table v2 column headers. I'll inspect TableRenderers.tsx in plugin-chart-pivot-table, remove/adjust the invalid role="columnheader" on the inner <span> (since <th> already exposes columnheader inside <tr>), add a unit test, and open a PR.
Update after checking master vs 6.1.0:
In 6.1.0, superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx indeed rendered <span role="columnheader" tabIndex={0}> inside <th className="pvtColLabel">.
However, on master, this was already fixed by #42078 (e54eccd, chore(a11y): enable jsx-a11y/prefer-tag-over-role as error), which replaced <span role="columnheader" tabIndex={0}> with <button type="button" className="sort-icon-btn">.
So span[role="columnheader"] is no longer present on master — closing/no PR needed against master unless a backport to 6.1 is desired.
Closing the issue since it's fixed on master