-
Notifications
You must be signed in to change notification settings - Fork 788
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
false positive in color contrast #2851
Comments
Thanks for the issue. Due to security concerns I can't open a zip file. Is it possible to move it to something like Codepen or paste the contents in a comment? |
@straker here is the Codepen repro of the same issue: https://codepen.io/iamrafan/pen/ExZVobv |
Thanks, that helps a lot. I can see what's going on but I'll need to investigate it further. The root issue is that our custom element stack code is not returning the correct order of elements for this case. |
I've narrowed it down to the commons/dom/get-rect-stack:getPositionOrder function. It returns a different value (0) if the element is statically positioned (which is the case for a div without relative positioning) than for an element with not-static positioning (returns 3). Next step, investigate the links from the comments on that function and determine whether that's actually what we should be doing. I can make the two code snippets (one with
but I don’t know that that’s actually the correct solution for all cases. |
We've encountered a false positive in the color contrast tests. Expand Header contrast demo.zip, which contains an MHT file that is derived from a subset of an actual page that was scanned. Open the MHT file in your browser and run the axe-core color contrast rule on the text. It will fail because it's picking up the incorrect background color. If you remove position: relative from the h1 styling, the correct background color is reported and the color contrast pass succeeds, even though the pages are visually identical. We see the same issue in Chrome, new Edge, and FireFox.
Product: axe-core
Expectation: The background color and test result should always be reported correctly, independent of the position attribute.
Actual: The position attribute alters the background color that is reported, causing the color contrast test to fail.
Motivation: False positives
The text was updated successfully, but these errors were encountered: