# Not all automated testing tools support Shadow DOM in web components

DevFeed: [Not all automated testing tools support Shadow DOM in web components](<https://devfeed.tech/articles/not-all-automated-testing-tools-support-shadow-dom-in-web-components-52326.md>)

Original publisher: [Read original article](<https://www.matuzo.at/blog/2024/automated-testing-tools-and-web-components>)

Author: Manuel Matuzović

Published: 2024-01-02T10:55:00Z

Content type: tutorial

Language: en

Sources: [Manuel Matuzović](<https://devfeed.tech/sources/manuel-matuzovic-blog.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Web Components](<https://devfeed.tech/topics/web-components.md>), [Web Accessibility (a11y)](<https://devfeed.tech/topics/web-accessibility.md>), [axe DevTools](<https://devfeed.tech/topics/axe-devtools.md>), [axe-core](<https://devfeed.tech/topics/axe-core.md>), [Web](<https://devfeed.tech/topics/web.md>)

Tags: [accessibility](<https://devfeed.tech/tags/accessibility.md>), [axe-core](<https://devfeed.tech/tags/axe-core.md>), [axe-devtools](<https://devfeed.tech/tags/axe-devtools.md>), [lighthouse](<https://devfeed.tech/tags/lighthouse.md>), [testing](<https://devfeed.tech/tags/testing.md>), [web-components](<https://devfeed.tech/tags/web-components.md>)

## AI overview

This article examines how automated accessibility testing tools handle Shadow DOM in web components. It compares axe DevTools, Lighthouse, ARC Toolkit, WAVE, and IBM Equal Access, showing that tool support varies and recommending targeted testing for components that use Shadow DOM.

## Source excerpt

There isn't much more to say; it's all in the title. Many automated testing tools are a collection of JavaScript functions you run on a page. Most of those rely on querying the DOM. If a tool doesn't consider shadow trees, it only catches accessibility errors in the Light DOM, which may give you a wrong sense of safety and potentially affect your users. That's one more reason not to rely on automated testing only. That doesn't mean you shouldn't use automated testing if your site contains web components. You just have to ensure that the tool you're using supports them. A good way of doing that is creating a simple component that contains some accessibility bugs caused by nodes attached to the component's Shadow DOM, like the following component. <main> <h1 id="h1">Testing a11y bugs in web components</h1> <a href="#el">Jump to elem in shadow</a> <!-- Broken skip link --> <some-bugs></some-bugs> </main> <script> class SomeBugs extends HTMLElement { constructor() { super(); this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = ` <style>:host { color: #efefef }</style> <!-- Low contrast. --> <h4 id="el">Heading</h4> <!-- Skipped heading. --> <img src="#test"> <!-- Missing alt. --> <button aria-labelledby="h1"></button> <!-- Broken ARIA reference/missing accessible name. --> <input type="text" id="input"> <!-- Missing label. --> ` } } customElements.define('some-bugs', SomeBugs); </script> CodePen: Test web component containing accessibility bugs If you add this component to a page, testing tools should find at least five issues. I picked five popular tools: axe DevTools, Google Lighthouse, ARC Toolkit, WAVE, and IBM Equal Access (IBM EAAC), and ran them against the component. axe DevTools and Lighthouse, both based on axe-core, found all five issues. WAVE found no problems in Shadow DOM, but reported a broken skip link in Light DOM. WAVE and ARC are the only tools that check for broken anchor links. Arguably, because it's not an obvious accessibility issue or W