-
Notifications
You must be signed in to change notification settings - Fork 773
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
color-contrast false positive on element styled as screen-reader-only #2962
Comments
(context: #2171 discusses a similar symptom with a different root cause) |
I thought axe-core did exclude these... I'll have to take a closer look. Thank you for reporting Dan! |
I believe our sr-only exclusion was based on a few things:
Our code is saying this version of sr-only is visible since it doesn't do any of those things. I'm not sure what would be the best approach to say that this element is hidden (width/height set to |
Still needs to go to QA. |
Product: axe-core
Expectation: Elements using the following sr-only CSS should be detected as inapplicable to the color-contrast rule:
Gist containing a full self-contained repro
Actual: Elements with that
sr-only
styling can fail thecolor-contrast
rule.Motivation: An Accessibility Insights for Web user reported this as a false positive.
Notes:
As a workaround, we've recommended that the user add a
clip: rect(0,0,0,0);
property to theirsr-only
class, similar to Bootstrap'ssr-only
implementation. This causes axe-core to understand that the element should be ineligible for thecolor-contrast
test.However, the item is still invisible without the
clip
property (the combination of other properties is sufficient), so it would be ideal for axe-core to understand that.This technically caused a false positive, but one that has a straightforward workaround and which is straightforward for a user to "fix" by adding noop color CSS according to the color-contrast instructions, so I'd consider this to be lower priority than most other false positive issues.
The text was updated successfully, but these errors were encountered: