superset icon indicating copy to clipboard operation
superset copied to clipboard

Dashboard chart description is rendered as aria-label on a role-less div (axe aria-prohibited-attr)

Open asmarmomand opened this issue 1 week ago • 1 comments

Bug description

When a chart has a description, the dashboard renders that description as an aria-label on the chart's wrapper <div>, and that <div> has no ARIA role. axe-core reports the serious rule aria-prohibited-attr ("aria-label attribute cannot be used on a div with no valid role attribute"), because aria-label is not allowed on a generic element.

Example element reported by axe-core 4.12.1:

<div class="dashboard-chart superset-x36kch" aria-label="Catalogue indicator: notifiable-cases.">

where Catalogue indicator: notifiable-cases. is the chart's description text.

How to reproduce the bug

  1. Create any chart and give it a description (Edit chart properties, "Description").
  2. Add the chart to a dashboard and open the dashboard.
  3. Run axe-core (for example the axe DevTools browser extension, or @axe-core/playwright with the tags wcag2a, wcag2aa, wcag21a, wcag21aa).
  4. Look at the aria-prohibited-attr result: one node per chart that has a description, div.dashboard-chart[aria-label].

Expected results

No aria-prohibited-attr violation. The wrapper should either carry a role that allows a name (for example role="figure" or role="group" with the label), or the description should be exposed in some way that does not put aria-label on a role-less div.

Actual results

Serious aria-prohibited-attr violation on every chart that has a description.

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-prohibited-attr (impact: serious). Found while running an automated accessibility check over a set of dashboards; the check is repeatable on any dashboard with described charts.

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.

asmarmomand avatar Nov 24 '26 21:11 asmarmomand

Hi! I'd like to work on this issue as my first Apache Superset contribution.

I've traced the issue to ChartWrapper in superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx. It currently receives aria-label={slice.description} while rendering as a generic div.

My proposed minimal fix is to conditionally apply role="figure" and the accessible name only when the description is non-empty. This would preserve the existing screen-reader description behavior while avoiding the aria-prohibited-attr violation. I'd also add focused tests to Chart.test.tsx.

Would maintainers consider role="figure" semantically appropriate for this wrapper, including when the visualization contains a data table, or would role="group" be preferable?

Please let me know if anyone is already working on this issue. Thanks!

Akash-Rajkumar avatar Nov 25 '26 09:11 Akash-Rajkumar