dequelabs / axe-core

Accessibility engine for automated Web UI testing
https://www.deque.com/axe/
Mozilla Public License 2.0
5.94k stars 774 forks source link

Failure to specifying foreground colors without specifying background colors or vice versa #3083

Open mgifford opened 3 years ago

mgifford commented 3 years ago

I'd like axe to evaluate for Failure of Success Criterion 1.4.3, 1.4.6 and 1.4.8 due to specifying foreground colors without specifying background colors or vice versa.

Evaluating that both are present seems to be an "easy enough" test of CSS.

Product: axe-core

Expectation: I'd like to see a notice that this is a failure of WCAG 2.1 AA.

Actual: It is missed from the crawl.

Motivation: I saw it in another tool and it occurred to me, "why didn't my axe scans identify this?"

straker commented 3 years ago

That's an interesting idea. We'd have to nail down the requirements, but from a high level it would seem that if every visible element with content (basically what our current color-contrast grabs) has both a background color and foreground color (without relying on browser defaults), then we would flag it as a failure. Does that sound about right?

mgifford commented 3 years ago

Sounds right to me. http://qualweb.di.fc.ul.pt/evaluator/ has it if you want to look at how they evaluated this. Not sure if it is part of the W3C's ACT framework yet.

straker commented 3 years ago

I was looking into this one, and I'm having a slight problem with knowing if an element defines a foreground color. Since elements inherit color from the parent, and the default color is rgb(0, 0, 0), I can't think of an easy to know if the element

  1. defined it's own color
  2. inherited a defined color from a parent
  3. has no defined color (uses browser default)

Do you know how that evaluator determines if a color has not been set?