-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axe-storybook misidentifying background color #39
Comments
Thanks for raising this issue! Looks like this example is the first tab (which is green), and Axe thinks there's a light-ish blue background color. Is this happening for only tabs, or is it also affecting other kinds of buttons/links? Normally when I see something like this, it's one of
Are any of these possibilities? Could run axe-storybook in non-headless mode, with the |
OK! Sorry for the delayed response; unfortunately, my bandwidth to work on this Storybook a11y project has diminished recently, so we'll see if I can drive this to completion. Anyways, based on your suggestion that there might be some obscuring or overlapping between test runs that's causing this color-contrast to be reported, I was able fix my issue by applying some targeted <style>
div#root {
background-color: white;
}
</style> This appears to remove all the false-positive color-contrast issues! Still unsure why this fix is necessary though; I would've hoped that Storybook/Playwright would be able to isolate test runs from each other (assuming that's even the issue). |
No worries, @tstewart15! I wonder if you're running into storybookjs/storybook#13612. When axe-storybook-testing transitions from one story to the next, any transitions of background color coming from either the story or from storybook itself will still happen. This can interfere with the color contrast checks. In the apps I work on we work around storybook's background transition with @media (prefers-reduced-motion) {
.sb-show-main {
transition: none !important; /* !important needed to counter inline style */
}
} which works because axe-storybook-testing forces I actually forgot all about this until your comment reminded me. Will update the README to document this. |
If this is the issue you're facing, it also looks like from storybookjs/storybook#13711 that Storybook itself will resolve this in v6.4. |
I'm seeing many examples of color-contrast issues where the "background color" reported is incorrect.
In my case, I'm continually seeing links and buttons fail due to insufficient color contrast, and
background color: #0073b1
. For example:The actual background color in Storybook though is white. Here's the example above, depicted in Storybook:
The Storybook "Accessibility" tab correctly doesn't report any color-contrast issues here. Any idea what could be causing this issue?
The text was updated successfully, but these errors were encountered: