What TanStack Charts does for trees, treemaps, sunbursts, networks and sankeys on its own, and what you add so that everyone can read them.
What you get
A named chart. ariaLabel is required, and the chart is exposed as an image with that name. ariaDescription adds a longer description.
Keyboard navigation, on by default. Tab moves into the chart and focuses the first node. Arrow keys move between them, and Home and End jump to the first and the last. Enter or Space pins a sticky tooltip, and Escape closes it.
The tooltip is announced to screen readers as it changes, so a keyboard user hears the values of the focused node.
A visible focus ring in the theme's focus color, shown for keyboard focus only.
Reduced motion. Animated charts skip their animation when the reader has asked for less motion.
An interactive legend made of real buttons, each with a pressed state, when you use interactiveColorLegend.
What you add
A label that says what the chart shows, its unit and its period. "Order fulfillment by warehouse, this week" works. "Sankey diagram" does not.
A visible title, and a subtitle with the unit and the period, in HTML next to the chart.
The exact values another way, when they matter: a table under the chart, behind a toggle, or a download.
A second signal besides color for every series or part.
A keyboard path for every control you add yourself, such as a series filter or a period picker.
Name and describe the chart
Keep the label short and put the takeaway in the description. Do not put every value into the name: a screen reader reads it in one breath.
<Chart
definition={definition}
ariaLabel="Order fulfillment by warehouse, this week"
ariaDescription="Of 1,284 orders, 772 shipped from Berlin and 512 from Lyon, and all were delivered."
/>
Give the values as a table
A table is the most reliable way to give exact values to everyone, including people who zoom far in or print the page. Render the same array the chart reads with the kit's Table, under the chart or behind a "Show as table" switch. When the values are only an illustration, a one sentence summary is enough.
Do not rely on color
Label nodes, cells and flows directly with their names, so no one has to match a color to a legend.
In a treemap or a sunburst, separate the cells with a stroke in the surface color, so neighbors with close colors stay apart.
In a sankey that colors flows by meaning, such as profit and cost, also say it in the node labels.
Marks need enough contrast with the background. Check light colors from a palette against the page in light and dark mode.
Give the structure as text
A screen reader cannot follow lines between nodes. Give the same structure in a form it can read, next to the chart or behind a "Show as list" switch.
A tree, treemap or sunburst: a nested list, or the kit's Tree, with each node's value.
A network: a table with one row per link, its two ends and its weight. Or one row per node with its neighbors.
A sankey: a table with one row per flow, from, to and value.
Build the list from the rows the chart reads, so the two never disagree.
<ul aria-label="Order flows">
{flows.map((flow) => (
<li key={`${flow.source}-${flow.target}`}>
{label(flow.source)} to {label(flow.target)}: {flow.value} orders
</li>
))}
</ul>
Drill down from the keyboard
onSelect fires on Enter and Space as well as on click, so a drillable sunburst opens with the keyboard too. Say so in ariaDescription, and give going back a real button that the keyboard can reach.
Turning the keyboard off
A static chart with no tooltip can pass keyboard: false in the second argument of defineChart, so it does not add a tab stop. Keep it on for any chart that shows values on hover: otherwise keyboard users never see them.
Check it
Tab into the chart and read every node with the arrow keys.
Listen to it with a screen reader.
Zoom the page to 400% and confirm the values are still there.
View it in grayscale and confirm the series are still apart.
The Accessibility guideline has the principles that apply to every chart.