Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created January 3, 2022 22:47
Show Gist options
  • Save nolanlawson/93ece57f90ab9b2318a18628abaac428 to your computer and use it in GitHub Desktop.
Save nolanlawson/93ece57f90ab9b2318a18628abaac428 to your computer and use it in GitHub Desktop.
repro axe-core shadow button
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<main>
<h1>Test</h1>
<button id="shadow-button"><div id="shadow-button-inner"></div></button>
</main>
<script>
document.getElementById('shadow-button-inner')
.attachShadow({ mode: 'open' }).innerHTML = 'Click me!'
</script>
<script src="https://unpkg.com/[email protected]/axe.js"></script>
<script>
axe
.run()
.then(results => {
if (results.violations.length) {
throw new Error('Accessibility issues found');
} else {
console.log('No accessibility issues found')
}
})
.catch(err => {
console.error('Something bad happened:', err.message);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment