Nested Interactive Elements: An Nightmare in Accessibility

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2026
November 17 - 20, 2026
New York, US & Online
Upcoming event
React Summit US 2026
React Summit US 2026
November 17 - 20, 2026. New York, US & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

There have been numerous remarkable new UX experiences developed over the years, such as cards displaying an array of products and clickable list items with dynamic menu options, among others. However, only a few are aware of the challenges involved in building these structures with accessibility in mind, and unfortunately, some of them are completely inaccessible. 


In today's talk, we will explore some of these prevalent web UX patterns and delve into the hidden challenges they present. While we may be able to mitigate some of these issues, others serve as cautionary tales in accessibility.

This talk has been presented at React Advanced 2023, check out the latest edition of this React Conference.

FAQ

The speaker of the talk is Catherine Johnson, also known as Cat Johnson.

The main topic of the talk is nested interactive elements and their impact on accessibility.

Cat Johnson specializes in front-end web components, specifically React components, with a focus on accessibility.

Cat Johnson received multiple accessibility bugs related to nested interactive elements in the Your Info page on account.Microsoft.com, which prompted her to investigate the issue further.

Nested interactive elements are interactive elements that are nested within other interactive elements, such as a button within a link.

Cat Johnson's team decided to restructure the DOM elements to use appropriate roles, such as changing outer containers to 'listitem' or 'group', and ensuring that inner clickable elements are properly designated as buttons.

The outcome was improved accessibility for screen reader users, better documentation within her organization, and sharing her findings to help others avoid similar issues.

People can reach out to Cat Johnson at her website, catinthemachines.com.

Nested interactive elements are problematic because screen readers, which build off of basic HTML, often have difficulty reading and interpreting them, leading to garbled or unclear output for users.

Developers can avoid nested interactive elements by not creating them in the first place, unnesting elements where possible, limiting developer configurations, and using CSS to overlay elements instead of nesting them.

Cat Johnson
Cat Johnson
23 min
23 Oct, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The video addresses the challenges posed by nested interactive elements, which are interactive elements nested within other interactive elements, and their impact on web accessibility. It highlights the accessibility issues caused by these elements, particularly how screen readers struggle to interpret them, leading to garbled outputs. The talk suggests strategies to improve accessibility, such as using CSS overlay techniques instead of nesting, and restructuring the DOM to assign appropriate roles like 'listitem' or 'group'. The video also discusses the importance of unnesting interactive elements and limiting developer configurations to prevent accessibility conflicts. Additionally, the video emphasizes the continuous evolution of accessible solutions and the need for sharing learnings and documentation to improve accessibility across websites. Techniques like adjusting role properties and engaging with users for feedback are recommended to create a more cohesive experience.

1. Introduction to Nested Interactive Elements

Short description:

Welcome to my talk today. We're going to be talking about nested interactive elements and an accessibility nightmare. My name is Catherine Johnson, a software engineer at Microsoft specializing in accessibility. Let me share a story about my interaction with Nesta Interactive components. I encountered an accessibility bug on our site involving a list component. Initially, the list row had a role of a button, but it needed to be a list item. However, later, we received feedback that it should be a button again. Sometimes accessibility guidance changes.

Well, welcome everyone. Welcome to my talk today. We're going to be talking about nested interactive elements and an accessibility nightmare.

My name is Catherine Johnson, and thank you for joining me today. So, as I mentioned, my name is Cat Johnson. I'm a software engineer. I work at Microsoft, and I focus a lot of my work on front-end web components, specifically React components, and I specialize in accessibility.

Here, for instance, is one of the websites I work on a lot in my day-to-day job. This is the Your Info page on account.Microsoft.com. Today, I'm going to start us off with a little bit of a story about my work and my interaction with Nesta Interactive components.

So my day-to-day job, I'll be working and coding as one does, and one day I was working, and I got an accessibility bug on our site. I was talking to the tester, and they were explaining to me that there was an issue with a section of code on our page. This was sort of the area of our UX I was having a problem. So this whole container right here is a list component that we built in React. Right here, you can see that it has the HTML role of list. And inside of it, we have a list row inside that list, and it has the role of a button. We made it a role of button because that whole list row is clickable and it's very interactive. But the accessibility bug told us that, hey, the role of list, like the role of button, it needs to be a list now. It's not accessible. So, got that feedback. I was like, cool, perfect. We're going to remove it, we're going to change it, we're going to change it into a role of list item. So I get back to my workstation, I type away, I fix it. I push out the code, leave my brain, and I continue my work.

A few months go by, I'm working again, I get another accessibility bug. This time the tester is explaining to me that it's very similar or it's in the same experience. So, we can see it's the same list, the whole thing's a role of list. And that row that we change it to a list item, the accessibility tester said, hey, no, we can't do a role of list item, this whole thing is a button and it's clickable and has user interaction. So, for screen reader users, we needed to have a role of button to explain that to users. At first, I was a little confused on this feedback because it was previously a button, but now it's a role of list item, like, which one should it be? But you know what? Sometimes accessibility guidance changes.

2. Nested Interactive Elements and Accessibility Bugs

Short description:

I encountered an accessibility bug on our site involving a list component. The accessibility bug stated that when screen reader users were navigating to this internal button, it was starting to get all garbled, and it wasn't reading out properly. I decided I'm not going to fix this thing right away. I need to dig into what is happening in this experience so that I can really ascertain what is the best solution for our site. I've realized and discovered that the screen reader issues that I'm experiencing are all related to issues around nested interactive elements. Nested interactive elements are essentially interactive elements that are nested within other interactive elements.

So, I was like, all right, no problem. I'll change it to a button. That's fine. No problem. I continue on with my work, fix it, and then totally lose my mind until some time later. And again, working my desktop, I get an accessibility bug, and this accessibility bug is slightly different.

So, it's the same list, the row is a role of button, and inside of that whole row, there is a button that we have for users, and the accessibility bug stated that when screen reader users were navigating to this internal button right here in the green area, it was starting to get all garbled, and it wasn't reading out properly. And then, on top of that, the accessibility tester said that whole row should be a list of properties.

So, at this point, I'm just blown away. I'm so frustrated. I don't know what's causing the screen reader issue that's making this internal button read out all strangely, but there's a lot of miscommunication issues around what these roles and what these properties should be set for them to work with screen readers and assistive tools. So, at this point, I decided I'm not going to fix this thing right away. I need to dig into what is happening in this experience so that I can really ascertain what is the best solution for our site.

So, I start doing some research. I start digging into it, and I've blocked out the problem into two sort of bullet points. First, I need to fix the screen reader issue because right now as my experience exists, it is causing issues and users who are using screen readers or other tools cannot navigate to this internal button and they can't activate the experience that they're wanting to use. Then the second problem I need to fix is I need to figure out what is happening with this list item or button or whatever role, like miscommunication. Why is it not clear what role it should be? And I need to figure out what it actually needs to be.

So I start doing some research. I start digging online, looking into what is the screen reader issue? What is happening right there? And it's during this process that I've realized and discovered that the screen reader issues that I'm experiencing are all related to issues around nested interactive elements. So let's dig into what are nested interactive elements and why they might be causing problems for our site. So as a brief side note, nested interactive elements are very clear, like nested interactive elements are essentially interactive elements that are nested within other interactive elements.

So here's a really simple, brief slice of code that is a really great example of a lot of cases of nested interactive elements. We have an element that is a role button and inside it we have a link that has a specific click target. Now this example, when we think about basic HTML, a lot of basic HTML does not recommend we put buttons inside of links. So if you look back to early 90s web, it never really made sense to put links inside of buttons. It caused click target issues. But most notably there really wasn't a lot of good examples around users wanting an experience like that. And it didn't translate well to HTML. So a lot of early sites didn't really have links inside of buttons and you either used a link or used a button.

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
Top Content
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.
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.
How to do Good Without Doing Anything
React Advanced 2021React Advanced 2021
32 min
How to do Good Without Doing Anything
Accessibility is about making sure everyone can participate on the web, regardless of disability. Automated tools like Lighthouse and React Axe help identify accessibility errors and provide guidance on fixing them. Unit tests validate ARIA attributes and keyboard navigation, while integration and end-to-end tests focus on outcomes and simulate user experiences. Cypress.io is an open-source testing framework with excellent accessibility support. Implementing small changes leads to a deep understanding of web accessibility and bug resilience.

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 ;)
The Cake Is a Lie... And So Is Your Login’s Accessibility
React Advanced 2025React Advanced 2025
100 min
The Cake Is a Lie... And So Is Your Login’s Accessibility
Workshop
Ramona Schwering
Ramona Schwering
Much like the promise of cake in Portal, login forms are everywhere in web development. While they may seem functional at first glance, many users with disabilities encounter a maze of invisible walls, from keyboard traps to inaccessible CAPTCHAs. It's as if GLaDOS designed these forms herself to test us!In this practical walkthrough, we will debug the accessibility issues of a real React login component live, similar to traversing those test chambers: Using an actual screen reader, we'll show how minor improvements, such as proper ARIA implementation and effective focus management, can transform a complex test chamber into a smooth user experience. Additionally, we will address the common pitfalls that GLaDOS might throw at us in both the Portal universe and the real world of accessibility, especially concerning authentication processes and its special needs. So grab your portal gun—let's work together to break down these barriers and ensure that authentication truly works for everyone. The cake might be a lie, but accessibility doesn't have to be!