question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Button] Contrast for some default variants is too low

See original GitHub issue

Describe the bug According to chrome lighthouse, some variants are not a high enough contrast.

image

I am using a standard:

<Button minWidth="sm" variantColor="blue">Text</Button>

with css reset and default theme. It appears a number of variant colors don’t pass contrast ratios for lighthouse. I did a little investigation and a few tools all confirmed that the button I had created with the default theme was not considered accessible. Here are a few testers that failed it:

https://color.a11y.com/Contrast/

https://www.aditus.io/button-contrast-checker/

The second tester also called out the contrast of the focus outline for blue as being too low.

I only tested with blue but when i passed the chakra docs through these testers it looked like other colors might also fail.

Expected Behavior Variants in the default theme to pass accessibility standards.

Link to minimal reproduction Please provide a codesandbox link or GitHub repo with a minimal reproduction of the issue.

Steps to Reproduce Create a button using variantColor and run lighthouse on the page. Deploy the page to vercel and run either of the contrast checkers on it.

Suggested solution(s)

Bold text has less stringent contrast requirements but it seems like the solution is to darken the buttons with light text or lighten the buttons with black text.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jmiazgacommented, Aug 10, 2020
1reaction
segunadebayocommented, Aug 9, 2020

Thanks for reporting this @DavidJFelix

@with-heart, let’s plan to do a sweep across all components to check their color contrasts and improve them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

-ms-high-contrast - CSS: Cascading Style Sheets | MDN
High Contrast Mode is a specialized display mode that prioritizes making content as legible as possible by dynamically replacing foreground and ...
Read more >
Contrast (Minimum) - Low Vision Accessibility Task Force
Due to the different needs and preferences of low vision users, the contrast requirements for inactive user interface components (also known as disabled ......
Read more >
Configuring Variants - Tailwind CSS
Overriding default variants. Any variants configured directly under the variants key will override the default variants for that plugin. // tailwind.config ...
Read more >
Tips & tricks about Variants in Figma | by Thalion | UX Collective
When it comes to Button states, they are also useful. Prepare components to have properties like “Default, Hover, Pressed, Disabled,” so you ...
Read more >
Building a button component - web.dev
In this post I want to share my thoughts on how to build a color-adaptive, responsive, and accessible <button> element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found