Created
January 3, 2022 22:47
-
-
Save nolanlawson/93ece57f90ab9b2318a18628abaac428 to your computer and use it in GitHub Desktop.
repro axe-core shadow button
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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