xz / xz/new.css

Fails Lighthouse's "color contrast" accessibility audit (Background and foreground colors do not have a sufficient contrast ratio)

Open
#43 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
4.1k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Problem

You can easily reproduce this by running Lighthouse against the demo page @ https://newcss.net/.

In the report, under Accessibility -> Contrast, you will see this message:

Background and foreground colors do not have a sufficient contrast ratio.
Low-contrast text is difficult or impossible for many users to read. Learn more.

"Learn more" links to https://web.dev/color-contrast/

Below that we see a list of the failing elements. They are all the <a> elements within the <header> element.

So the color for <a> elements is fine against the body background color, but not dark enough against the header background.

Workaround

To fix this locally in my project, I override this new.css css rule:

a {
    color: var(--nc-lk-1);
}

with this custom css rule:

a {
    color: var(--nc-lk-2);
}

But I think this makes it less pretty.

Suggested solution

Unfortunately, I'm not really sure what a good solution would be, since I'm not much of a designer, but I thought I would bring up the issue at least.

Off-topic comments

Thanks for the sweet css framework! I'm really enjoying it! <3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run Lighthouse against the demo page at https://newcss.net/ and inspect the failing elements within

. Start with the a color rule using --nc-lk-1 and compare it with the header background and the suggested --nc-lk-2 workaround. Done means the Accessibility > Contrast audit no longer reports those links while retaining an acceptable appearance.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.