The color-contrast check doesn't work in JSDOM
See original GitHub issueHi there, thanks for building this fantastic library!
I’ve never gotten bad color contrast to create violations when testing React components with JSDOM. It seems to always return a false passing result (well, when it’s not timing out, but that’s a known JSDOM issue). I’ve created an example based off of this project’s jest+react example here.
I’m guessing it doesn’t work because JSDOM has not implemented ranges as part of its DOM implementation, and the code that checks for color contrast depends on that (document.createRange()
). But the false passing result is a bit concerning.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
axe-core - npm
Currently the color-contrast rule is known not to work with JSDOM. We can only support environments where features are either natively supported or...
Read more >Building your own color contrast checker - DEV Community
There are many great online tools that can help you check the color contrast, but in this post I am going to show...
Read more >Contrast Checker - WebAIM
Enter a foreground and background color in RGB hexadecimal format (e.g., #FD3 or #F7DA39) or choose a color using the color picker. The...
Read more >Does Siteimprove check color contrast in Accessibility?
Yes, Siteimprove checks for color contrast issues in Accessibility using guidelines described below. The color contrast ratio required ...
Read more >Text elements must have sufficient color contrast against the ...
Use the color contrast analyzer below to find colors that pass the guidelines. Color Contrast Analyzer. Foreground Color. Hex: RGB:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seeing the same here. Is there any known fix for this?
@mohanraj-r I tested out jsdom 18.0.1. Looks like something about the range API is still not fully working as I get this error when running a test: