"Background and foreground colors do not have a sufficient contrat ratio." Really?
See original GitHub issueBug report
Provide the steps to reproduce
- Run LH on any webpage (for example on youtube.com).
What is the current behavior?
I have this on my webpage: Lighthouse:
CSS:
div#warningbackground { background-color: #ff0000; }
span#warningtext {
color: #ffffff;
font-size: 20px;
}
span#warningtext a {
background-color: #ffffff;
padding: 2px 5px 4px 5px;
color: #0000ff;
}
What is the expected behavior?
I think contrast ratio is more than OK.
Environment Information
- Affected Channels: *Chrome: 67.0.3396.99 a337fbf3c2ab8ebc6b64b0bfdce73a20e2e2252b-refs/branch-heads/3396@{#790}
- Operating System: Windows 10
V8 6.7.288.46 Related issues
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Text elements must have sufficient color contrast against the ...
All text elements must have sufficient contrast between text in the foreground and background colors behind it in accordance with WCAG 2 AA...
Read more >How to fix "Background and foreground colors do not have a ...
To fix these issues, you must adjust the contrast ratio of the background and foreground colors. One software that you can use is...
Read more >Solve Background and Foreground Color Contrast Problems
Does your website have a sufficient color contrast ratio? · First of all, right-click on the image you want to check. If you're...
Read more >Insufficient Color Contrast - Equalize Digital
To fix an Insufficient Color Contrast error, you will need to ensure that flagged elements meet the minimum required ratio of 4.5:1. To...
Read more >G18: Ensuring that a contrast ratio of at least 4.5:1 ... - W3C
If the background is a solid color (or all black or all white) then the relative luminance of the text can be maintained...
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
@englishextra axe-core v4.x appears to resolve this issue (I can’t duplicate the above issue in via @axe-core/cli on 4.0.2, as seen running the specific color-contrast rule on the cli below).
Currently, we’re pegged to 3.5.5, but this is on the v7 roadmap for update in #11207
@englishextra that almost certainly is because of the offscreen slides that page has that mess up background color detection. Separate bug welcome though I don’t know if we’ll be able to do much about it (axe seems to just skip them in latest version).