Skip to content
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 fails with new color spec #4007

Closed
1 task done
enyo opened this issue May 5, 2023 · 14 comments · Fixed by #4020
Closed
1 task done

Axe fails with new color spec #4007

enyo opened this issue May 5, 2023 · 14 comments · Fixed by #4020
Assignees
Labels
color contrast Color contrast issues commons Issues in the common code (lib/commons) fix Bug fixes pr A pr has been created for the issue

Comments

@enyo
Copy link

enyo commented May 5, 2023

Product

axe-core

Product Version

No response

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Expectation

I’m using oklch on my page. I have added a media query to test if the browser supports it, and fall back to rgb() if not. I expect axe-core to either ignore my oklch definitions, or be able to parse them properly.

Actual

axe-core fails with:

axe-core Error: Unable to parse color "oklch(0.992 0.03 171.25)”

image

How to Reproduce

<div>Test</div>
<style>
  div {
    background: #000;
    text: white;
  }
  @supports (color: oklch(0% 0 0)) {
    div {
      background: oklch(0% 0 0);
    }
  }
</style>

Additional context

This prevents me from using the new color syntax since my accessibility tests completely break.

@enyo enyo added the ungroomed Ticket needs a maintainer to prioritize and label label May 5, 2023
@bramus
Copy link

bramus commented May 8, 2023

Was just about to file a similar issue, after I noticed it couldn’t parse oklab colors: axe-core Error: Unable to parse color "oklab(0.876139 0.0000397742 0.0000175595)"

My snippet specifically uses the color-mix function:

--bgcolor: red;
background: color-mix(in oklab, var(--bgcolor), white 20%);

When changing the colorspace to srgb it still fails, as the value axe then tries to parse is the generic color(…).

@WilcoFiers
Copy link
Contributor

Thanks for reporting. We clearly missed something here.

@WilcoFiers WilcoFiers added fix Bug fixes core Issues in the core code (lib/core) color contrast Color contrast issues commons Issues in the common code (lib/commons) and removed ungroomed Ticket needs a maintainer to prioritize and label core Issues in the core code (lib/core) labels May 9, 2023
@straker
Copy link
Contributor

straker commented May 9, 2023

@enyo Could you elaborate on what you mean that this completely breaks your accessibility tests? I tested out the code and axe-core does not crash but instead just reports the problem as an incomplete issue of color-contrast. Are you checking the incomplete property of the axe results in your tests?

@bramus
Copy link

bramus commented May 9, 2023

It breaks the accessibility test in Lighthouse, which uses axe-core under the hood.

See https://twitter.com/bramus/status/1655504052518637569 + follow-up tweet for an example report.

@straker
Copy link
Contributor

straker commented May 9, 2023

Thanks for the added context, that helped a lot to understand what is going on.

@enyo
Copy link
Author

enyo commented May 10, 2023

@straker exactly as @bramus said: it breaks my lighthouse tests, and so I can’t use the color because then I just don’t get a meaningful result (and I wouldn’t settle for anything less than 100 anyway 😉)

I too reverted to using basic colors but I’d love to use the new ones because they are just more vibrant on displays that support them.

@enyo
Copy link
Author

enyo commented May 15, 2023

@straker wow! Thanks for the quick fix. Do you know when this will be available on pagespeed.web.dev?

@straker
Copy link
Contributor

straker commented May 15, 2023

@enyo Can't say for certain but I feel that they do a good job of keeping up-to-date on patch releases.

@padmavemulapati
Copy link

Validated with the lates axe-core develop branch code base,

now not seeing failures for color combinations, like hwb(), lab(), lch(), oklab(), and oklch().
We are supporting all those css color specs [hwb(), lab(), lch(), oklab(), and oklch]

Screen.Recording.2023-05-25.at.11.28.34.AM.mov

@wokalek
Copy link

wokalek commented Jul 5, 2023

Still have this issue.

You can run test lighthouse on evilmartians.com which is will fails. They have only oklch colors.

@straker
Copy link
Contributor

straker commented Jul 6, 2023

@wokalek I tested the page with [email protected] and it doesn't break the color contrast test. Looks like lighthouse pulled in 4.7.2 a few weeks ago. I tried to run lighthouse on the page but it just freezes on "Lighthouse is warming up..."

@wokalek
Copy link

wokalek commented Jul 6, 2023

@wokalek I tested the page with [email protected] and it doesn't break the color contrast test. Looks like lighthouse pulled in 4.7.2 a few weeks ago. I tried to run lighthouse on the page but it just freezes on "Lighthouse is warming up..."

I know this issue with "Lighthouse is warming up...", that's another (:

You can chrome://restart if you see this issue in lighthouse. Retest please.

@wokalek
Copy link

wokalek commented Jul 6, 2023

@straker
Testing in guest window.

image

@enyo
Copy link
Author

enyo commented Jul 13, 2023

I just tested on PageSpeed Insights and my oklch colors finally pass! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color contrast Color contrast issues commons Issues in the common code (lib/commons) fix Bug fixes pr A pr has been created for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants