a11y & Interactive Canvases

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2025
November 18 - 21, 2025
New York, US & Online
The biggest React conference in the US
Learn More
In partnership with Focus Reactive
Upcoming event
React Summit US 2025
React Summit US 2025
November 18 - 21, 2025. New York, US & Online
Learn more
Bookmark
Rate this content

Thinking of using <canvas> to render your UI? Great idea! But let’s make it accessible. Learn how to leverage the DOM tree structure to allow users to interact with your canvas using the keyboard and a screen reader. Find out about tricky gotchas and how to work around these.

This talk has been presented at JSNation 2025, check out the latest edition of this JavaScript Conference.

FAQ

AG Grid's charting component is used for drawing various types of charts including bar charts, financial charts, and map charts using an HTML5 canvas.

HTML5 canvas offers control over rendering logic allowing for better optimization specific to use cases, and it handles lots of data points efficiently without needing to create XML tags for each point, unlike SVG.

AG Grid ensures accessibility by using proxy HTML elements with transparent backgrounds on top of the canvas, allowing them to interact with screen readers and provide focus indicators for keyboard users.

Proxy elements in canvas-based chart accessibility act as invisible HTML elements that provide interaction and accessibility features like focus indicators and screen reader support without being visible on the canvas.

Yes, focus indicators can be used with canvas-rendered charts by utilizing extra HTML elements with a focus-visible CSS pseudo-class to provide visual cues for keyboard users.

AG Grid uses two HTML elements for focus switching to reliably trigger screen reader announcements by alternating the focus between these elements.

Challenges include ensuring screen reader support and focus indicators work for dynamic and interactive elements, as well as handling large numbers of data points effectively.

To make a line chart with 300+ data points accessible, AG Grid uses markers for specific data points and considers implementing features to allow skipping through points efficiently.

ARIA Live Assertive was found to be less reliable than focus switching for making assertive screen reader announcements, so focus changes are used instead.

Oli Legat
Oli Legat
28 min
12 Jun, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Oli's talk delves into the importance of accessibility and interactive canvases, comparing SVG and canvas rendering for chart components. The discussion includes enhancing SVG elements with ARIA attributes for better screen reader interpretation, implementing accessible canvas using proxy elements, and showcasing interactive elements with focus visibility. The talk also explores dynamic focus indicators, AI integration for screen readers, and the optimization of canvas over SVG for performance. Considerations for EU accessibility testing, direct screen reader APIs, and image-to-speech conversion using TransformersJS are discussed.
Available in Español: a11y y Lienzos Interactivos

1. Accessibility and Interactive Canvases

Short description:

Oli's talk covers accessibility, interactive canvases, and AG Grid's charting component using HTML5 canvas instead of SVG. Pros and cons of SVG and canvas rendering are discussed.

Thank you, everyone, for coming here today to watch my talk about accessibility and interactive canvases. So, just a real quick introduction. My name is Oli. I'm a former game developer. I have worked with LarCraft and Sonic the Hedgehog in the past. Great people, by the way. I love them. Nice people. And so now, I work at a company you may have heard of called AG Grid, and I work on the team which does the charting component.

So here, this is basically our website. I'll just quickly show you what it is so that we're all on the same page. So essentially, yeah, it's a framework agnostic library for drawing charts, such as bar charts like this. We also can draw financial charts. We also have some map charts here as well. All different types of charts. One of the key features of our library is that it is rendered using a HTML5 canvas as opposed to an SVG, which is what most other charting libraries use. There are a few exceptions.

So as you can see, like this toolbar here, those are just regular HTML5 buttons. But specifically for this talk, I'm going to focus on the canvas rendering part of AG charts. So the problem space that we're dealing with is when you're rendering a chart, the big question is, should I be using an SVG image or should I be using a canvas? I'm sure most of you are already familiar with the concept of these two, but just to make sure everyone understands, let's quickly go over the pros and cons. So an advantage of the SVG is that, so that's basically a vector-based rendering system. It's rendered by your layout engine, like Chrome or Safari. And it has an XML hierarchy where all of the shapes and everything are defined by some XML tags. Canvas, on the other hand, that's just a single HTML element. The JavaScript developer is responsible for writing all the rendering logic for actually drawing the code. And so you don't have a hierarchy. You just have that single element. The two are basically very, very similar to one another. So as you can see, these two images, they're exactly the same image. One of them is rendered by an SVG where you say, OK, I want a circle here, I want a rectangle here, and I want a polygon.

2. SVG Attributes and Accessibility

Short description:

SVG allows for additional attributes for screen readers, unlike canvas. ARIA attributes enhance accessibility for SVG elements, enabling easier interpretation by screen readers.

Same thing here with the canvas, but it's written in JavaScript as opposed to XML where I want a circle, a rectangle, a triangle, and so forth. And so the main advantage of an SVG is that, because you have these XML tags inside your DOM, you can basically, as I'm going to show you right here, if you inspect here, you can set some additional attributes onto the elements. So for those who aren't familiar, there is this concept called ARIA where you can basically say, for example, raw button. This will tell the screen reader to treat this element just like if it was a regular button.

And let's try to see what happens now if we turn on the screen reader. VoiceOver on Safari. Comparison. Button. Less than. Button. Three items. Button. Button. Button. You are currently muted. So as you can see, because now I've set those rules on those XML attributes, the screen reader is able to pick it up and says, OK, these shapes are actually buttons, so I'm just going to treat them as buttons. Then you have to add other handlers like the keyboard and mouse input handling. But you can basically tell the screen reader, yeah, this is what the buttons are.

We cannot do that with the canvas because it's just that single element. So how did I get around this? Well, basically, the solution that I found was to just quite simply hide the canvas. Well, not completely hide it, obviously. We still draw it on the screen. But there is this attribute called aria-hidden. We set that to true to tell the screen reader, just don't pay attention to this canvas. Nothing important here. And then what we have is we've got this concept called proxy elements. And that's essentially just some HTML elements on top of the canvas, but they have a transparent background. Basically, they're not drawn. They're there in the tree. They're there in the DOM.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Accessibility at Discord
React Advanced 2021React Advanced 2021
22 min
Accessibility at Discord
This Talk discusses the accessibility efforts at Discord, focusing on keyboard navigation and the challenges faced with implementing focus rings and outlines. The speaker showcases a unified focus ring system and a saturation slider to address accessibility concerns. They also highlight the implementation of role colors and the use of CSS filters for accessibility improvements. The Talk concludes with insights on runtime accessibility checking and the development of a performant core runtime system for checking accessibility issues.
Configuring Axe Accessibility Tests
TestJS Summit 2021TestJS Summit 2021
30 min
Configuring Axe Accessibility Tests
Top Content
AXe is an accessibility engine for automated web UI testing that runs a set of rules to test for accessibility problems. It can be configured to disable or enable specific rules and run based on tags. Axe provides various options, but axe linter does not support all options. The importance of investing time and resources in accessibility is emphasized, as it benefits not only those with disabilities but improves the web for everyone. Manual testing is also highlighted as a necessary complement to automated tests for addressing accessibility issues.
Nested Interactive Elements: An Nightmare in Accessibility
React Advanced 2023React Advanced 2023
23 min
Nested Interactive Elements: An Nightmare in Accessibility
Top Content
Watch video: Nested Interactive Elements: An Nightmare in Accessibility
Nested interactive elements can cause accessibility issues on websites, and the speaker shares a personal experience with an accessibility bug involving a list component. Mitigating nested interactive structures involves limiting these patterns during development and restructuring existing elements. The speaker provides recommendations for improving accessibility, such as adjusting role properties and gathering user feedback. The conclusion emphasizes the importance of accessible solutions and encourages sharing resources to build more inclusive experiences.
Dialog Dilemmas and Modal Mischief: A Deep Dive Into Pop-Ups
JSNation 2023JSNation 2023
10 min
Dialog Dilemmas and Modal Mischief: A Deep Dive Into Pop-Ups
The Talk discusses the use of dialogues and popovers in web development. Dialogues can be modal or non-modal and are now accessibility-supported. Popovers are versatile and can be added to any element without JavaScript. They provide suggestions, pickers, teaching UI, list boxes, and action menus. Modal and non-modal dialogues and popovers have different behaviors and dismissal methods. Browser support for these features is expanding, but there are still open questions about positioning, semantics, and other use cases.
Building a Fast Website for Every Single Visitor
React Advanced 2024React Advanced 2024
31 min
Building a Fast Website for Every Single Visitor
This talk focuses on building a fast and accessible website for all users, highlighting the importance of performance and user experience optimization. It emphasizes the need for adaptive implementation to cater to different devices and user conditions. The talk also discusses the factors beyond the developer's control, such as screen size, browsers, devices, internet connection, and sitting position. It highlights the significance of optimizing image components for various devices and the role of browser support and rendering engines. The speaker discusses the use of future APIs and the challenges of browser compatibility, as well as optimizing image formats and bundler compatibility. The talk provides insights on controlling bundler and device compatibility, optimizing CPU usage, internet connection, and JavaScript form submission. It concludes with a proposal to respond with save data instead of effective type for limited internet connections and recommends using React with adaptive hooks for better user experiences. Overall, the talk covers essential aspects of building a fast and accessible website.
a11y and TDD: A Perfect Match
JSNation 2022JSNation 2022
24 min
a11y and TDD: A Perfect Match
This Talk explores the intersection of accessibility and test-driven development (TDD) in software development. TDD is a process that involves writing tests before writing production code, providing a safety net for code changes. The Talk demonstrates how to apply TDD principles to real-life examples, such as filling out a form, and emphasizes the importance of user-centric testing. By using atomic design principles, code can be organized in a clean and easy way. The Talk also discusses the use of labels and test IDs in tests for improved accessibility.

Workshops on related topic

Web Accessibility for Ninjas: A Practical Approach for Creating Accessible Web Applications
React Summit 2023React Summit 2023
109 min
Web Accessibility for Ninjas: A Practical Approach for Creating Accessible Web Applications
Workshop
Asaf Shochet Avida
Eitan Noy
2 authors
In this hands-on workshop, we’ll equip you with the tools and techniques you need to create accessible web applications. We’ll explore the principles of inclusive design and learn how to test our websites using assistive technology to ensure that they work for everyone.
We’ll cover topics such as semantic markup, ARIA roles, accessible forms, and navigation, and then dive into coding exercises where you’ll get to apply what you’ve learned. We’ll use automated testing tools to validate our work and ensure that we meet accessibility standards.
By the end of this workshop, you’ll be equipped with the knowledge and skills to create accessible websites that work for everyone, and you’ll have hands-on experience using the latest techniques and tools for inclusive design and testing. Join us for this awesome coding workshop and become a ninja in web accessibility and inclusive design!
Automated accessibility testing with jest-axe and Lighthouse CI
TestJS Summit 2021TestJS Summit 2021
85 min
Automated accessibility testing with jest-axe and Lighthouse CI
Workshop
Bonnie Schulkin
Bonnie Schulkin
Do your automated tests include a11y checks? This workshop will cover how to get started with jest-axe to detect code-based accessibility violations, and Lighthouse CI to validate the accessibility of fully rendered pages. No amount of automated tests can replace manual accessibility testing, but these checks will make sure that your manual testers aren't doing more work than they need to.
Web Accessibility in JavaScript Apps
React Summit 2022React Summit 2022
161 min
Web Accessibility in JavaScript Apps
Workshop
Sandrina Pereira
Sandrina Pereira
Often we see JavaScript damaging the accessibility of a website. In this workshop, you’ll learn how to avoid common mistakes and how to use JS in your favor to actually enhance the accessibility of your web apps!
In this workshop we’ll explore multiple real-world examples with accessibility no-nos, and you'll learn how to make them work for people using a mouse or a keyboard. You’ll also learn how screen readers are used, and I'll show you that there's no reason to be afraid of using one!
Join me and let me show you how accessibility doesn't limit your solutions or skills. On the contrary, it will make them more inclusive!
By the end, you will:- Understand WCAG principles and how they're organized- Know common cases where JavaScript is essential to accessibility- Create inclusive links, buttons and toggleble elements- Use live regions for errors and loading states- Integrate accessibility into your team workflow right away- Realize that creating accessible websites isn’t as hard as it sounds ;)