Chart widgets can speak to screen readers

Chart widgets can speak to screen readers

  • accessibility
  • chart
PR #20628 by @danharrin

Chart.js lives on a canvas, so assistive tech can’t read the plot. You can now override getChartAssistiveContent() on a chart widget and return a string, Htmlable, or View which are visually hidden, but available to screen readers.

public function getChartAssistiveContent(): string
{
    return 'Sales rose from 0 in January to 549 in December.';
}

Pair it with a clear heading/description, and reuse getCachedData() so the alternative stays in sync when filters or polling update the chart.

public function getChartAssistiveContent(): View
{
    return view('filament.widgets.sales-chart-assistive-content', [
        'data' => $this->getCachedData(),
    ]);
}
All Filament Up To Date tips