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

Low contrast in generated demo page #19

Open
matatk opened this issue Jan 26, 2021 · 2 comments
Open

Low contrast in generated demo page #19

matatk opened this issue Jan 26, 2021 · 2 comments

Comments

@matatk
Copy link

matatk commented Jan 26, 2021

The feature that generates a demo page is a real time-saver. However, the styling makes the button and the link have very low contrast. The contrast ratio between the white and cyan is just 1.63:1. Depending on screen, environment and visual acuity, it will be hard for some people to see.

The Web Content Accessibility Guidelines (level AA) recommend at least a 3:1 contrast ratio for meaningful graphical elements (i.e. to help people identify the button against its background) and 4.5:1 for text (for the button's label, and the link)—though if the text is considered large this drops to 3:1.

There are some examples of how to improve non-text contrast on W3C's site.

If you're interested, I'd be happy to submit a PR that addresses the contrast issues. Here are two different possibilities...

  1. Simply use a darker colour than the cyan both for the button's background and link text.
  2. Use a darker colour for the link text, keep the cyan for the button's background, but use a darker colour for the button's text and add border.

Further, if you try tabbing through the page, the focus indication is very slight too, because it is using the browser's default, and in some browsers this means it's the same light cyan colour, and quite thin, so is also hard to see. (You can use CSS outline-offset to create a border between the focus outline and the button/link, to make it easier to meet contrast requirements.)

@mrcoles
Copy link
Owner

mrcoles commented Mar 28, 2021

@matatk good point! Here’s a start: 9d16e44

Let me know if you think other improvements should be made!

@matatk
Copy link
Author

matatk commented Apr 6, 2021

@mrcoles ah, this looks much clearer; great :-).

I'd definitely recommend some explicit focus/hover indication, as opposed to relying on the browser's default (sometimes this is quite low-contrast and easy to miss). I tried the very simple

a:focus, a:hover { outline: 3px solid #33e; outline-offset: 2px; }

and it seems to be quite clear, though it has the disadvantage of not following the rounded borders of the button alas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants