Birch UI v0.1
Pricing

Charts accessibilityCharts

Generated chart summaries, the hidden data table, keyboard navigation between points, announcements, reduced motion and palette contrast.

Open .md

A chart drawn on a canvas is invisible to assistive technology unless the component describes it. Birch UI Charts generates a text summary, keeps a full data table next to the chart, lets keyboard users move from point to point with spoken announcements, and ships a palette that meets contrast requirements in both themes.

The accessible summary#

The chart surface has role="img" and is focusable. Its accessible name is a summary generated from the title, the series and the axes, and it is updated whenever the data, the visible series or the zoom range change. For the revenue example in the overview, screen readers hear:

Monthly revenue by region, Fiscal year 2026, USD. Column chart with 3 series: North America, Europe, Asia Pacific; 12 data points. X axis: Jan to Apr. Y axis: $0 to $600K. Use the arrow keys to move between data points.

Pie and donut charts list their slices with percentages, for example "Sales by channel, Q2 2026. Donut chart with 4 slices: Online store 44.5%, Retail partners 27.1%, Field sales 18.5%, Marketplaces 10%." Combination and stacked charts say so ("Combination chart (column and line)", "100% stacked area chart"). Sparklines describe the trend: "Sparkline of Weekly units: starts at 412, ends at 530, low 398, high 530."

To write the name yourself, for example to state the conclusion the chart supports, set accessibility.label:

TypeScript
createChart(container, {
  title: 'Monthly revenue by region',
  data,
  series,
  accessibility: { label: 'Monthly revenue by region: North America grew 14% from January to April, Europe 11%.' },
});

The same summary is written to the <desc> element of exported SVG files.

The data table#

A table with the chart's data follows the chart in the DOM. It is visually hidden by default but read by screen readers, so users can inspect exact values in browse mode. The table has a caption with the chart title and a header row; for series with more than 1,000 points it contains the first 1,000 rows and its caption says so.

accessibility.dataTable controls it:

Value Result
'hidden' (default) Present for assistive technology, visually hidden
'visible' Shown below the chart for everyone
'off' Not rendered at all, for example when the same data is already in a grid on the page

Show or hide it at runtime with setDataTableVisible(), for example behind a toggle button that suits users who prefer numbers to shapes:

data-table-toggle.ts
const toggle = document.querySelector<HTMLButtonElement>('#show-revenue-table')!;
let visible = false;

toggle.setAttribute('aria-pressed', 'false');
toggle.addEventListener('click', () => {
  visible = !visible;
  chart.setDataTableVisible(visible);
  toggle.setAttribute('aria-pressed', String(visible));
  toggle.textContent = visible ? 'Hide data table' : 'Show data table';
});

Keyboard#

Focus the chart with Tab, then:

Key Action
Arrow Right / Arrow Left Next or previous point in the series
Arrow Down / Arrow Up Next or previous series at the same position
Home / End First or last point
Page Down / Page Up Jump forward or back by a tenth of the points
Enter or Space Activate the focused point, which fires pointClick
Escape Clear the point focus and the tooltip
+ / - Zoom in or out around the focused point
0 Reset the zoom

In horizontal bar charts the arrow keys follow the orientation: Arrow Down and Arrow Up move along the categories and Arrow Right and Arrow Left move between series.

Each move shows the tooltip at the focused point and is announced through a polite live region, for example "Europe, Mar: $301K. Point 3 of 4." Legend entries are buttons in the tab order, labelled with the series or slice name; Enter or Space toggles them.

Set accessibility: { keyboardNavigation: false } when a chart is purely decorative or duplicated by a table on the page. The summary then leaves out the arrow-key hint.

AccessibilityOptionsinterface@birchui/chartsFull reference
PropertyTypeDescription
labeloptionalstring—
dataTableoptionalDataTableMode—
keyboardNavigationoptionalboolean—

Motion#

Data and series changes animate for 450 ms by default. When the user's system asks for reduced motion (prefers-reduced-motion: reduce), charts skip the animation and draw the final state directly. Set animation: false to turn animation off for everyone.

Color and contrast#

The default categorical palette, DEFAULT_PALETTE, has eight colors that keep at least 3:1 contrast against both the light and the dark chart backgrounds, the WCAG 2.2 minimum for graphical objects, and adjacent colors stay distinguishable for common color-vision deficiencies:

Color On light (#ffffff) On dark (#111318)
#2b7de9 4.0:1 4.6:1
#d9650b 3.6:1 5.2:1
#0f9488 3.7:1 5.0:1
#a87b00 3.8:1 4.9:1
#c2459b 4.6:1 4.1:1
#3d8b37 4.3:1 4.4:1
#8257e5 4.7:1 3.9:1
#e0464b 4.1:1 4.6:1

If you supply your own palette or --lq-chart-color-* values, check them with the exported helpers:

check-brand-palette.ts
import { checkPaletteContrast, contrastRatio, DEFAULT_PALETTE } from '@birchui/charts';

const brandPalette = ['#0a6c9e', '#b54708', '#5c6ac4', '#2f855a', '#c53030'];

const failures = checkPaletteContrast(brandPalette, ['#ffffff', '#111318']).filter((report) => !report.passes);
for (const { color, background, ratio } of failures) {
  console.warn(`${color} on ${background} is only ${ratio.toFixed(2)}:1`);
}

console.info(contrastRatio('#1f2328', '#ffffff').toFixed(1));
console.info(DEFAULT_PALETTE.length);

checkPaletteContrast(palette, backgrounds, minimum = 3) returns one report per color and background, with the ratio and whether it passes. contrastRatio(a, b) returns the WCAG contrast ratio of two colors. Pass minimum: 4.5 when colors are used for text, such as data labels.

Color is never the only cue: every series also has a name in the legend, tooltip, summary and data table, and line series can use different marker shapes (circle, square, diamond, triangle).

Checklist#

  • Give every chart a title, or an accessibility.label when there is no visible title.
  • Prefer stating the conclusion in accessibility.label when a chart supports a specific point.
  • Keep dataTable on unless the same data is already on the page.
  • Check custom palettes with checkPaletteContrast() against every background they appear on.
  • Do not put essential information only in a custom tooltip; it is not part of the summary or the table.

↑ ↓ to move, Enter to open, Esc to close