Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dbjorge/9cbc74299092bbba4e33e3d2d47766a0 to your computer and use it in GitHub Desktop.

Select an option

Save dbjorge/9cbc74299092bbba4e33e3d2d47766a0 to your computer and use it in GitHub Desktop.
sr-only color-contrast false positive repro
<html lang="en">
<head>
<title>sr-only color contrast false positive</title>
<style>
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0px;
border: 0px;
overflow: hidden;
}
.low-contrast {
background-color: #ffffff;
color: #dddddd;
}
</style>
</head>
<body>
<main>
<h1>sr-only color contrast false positive</h1>
<p>Below this paragraph is an element styled as <code>sr-only</code> (<code>#repro</code>) which is incorrectly reported as a color-contrast violation.</p>
<span id="repro" class="sr-only low-contrast">
screen reader only text
</span>
<p>axe-core would ideally understand that the combination of CSS used by the .sr-only class results in the text being invisible.</p>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment