Skip to content

Conversation

@caugner
Copy link
Contributor

@caugner caugner commented Aug 29, 2025

Description

Increases the contrast between the background color with/without hover.

Motivation

Increase contrast:

Additional details

Yes No
Before image image
After image image

Related issues and pull requests

Fixes #653.

Only secondary/plain, as primary uses white text color.
@caugner caugner requested a review from a team as a code owner August 29, 2025 11:58
@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2025

8dd960c was deployed to: https://fred-pr666.review.mdn.allizom.net/

@caugner caugner changed the title fix(button): increase contrast for light positive action fix(button): increase contrast for light action buttons Aug 29, 2025
@caugner caugner marked this pull request as draft August 29, 2025 12:05
@caugner caugner marked this pull request as ready for review August 29, 2025 12:13
@OnkarRuikar
Copy link
Contributor

Please update the plain button hover contrast in dark mode as well:

 /* Plain */
  &[data-variant="plain"] {
    &:hover {
--      background-color: light-dark(var(--color-gray-80), var(--color-gray-20));
++      background-color: light-dark(var(--color-gray-80), var(--color-gray-40));
    }

The current hover is almost not noticeable. In the following video, the Clear button has the above change:

button_contrast-2025-08-31_11.06.45.mp4

In the above video, the buttons are zoomed in, but in the normal case hover color change is not visible.

@caugner caugner requested a review from LeoMcA September 1, 2025 12:50
@caugner
Copy link
Contributor Author

caugner commented Sep 1, 2025

Please update the plain button hover contrast in dark mode as well:

 /* Plain */
  &[data-variant="plain"] {
    &:hover {
--      background-color: light-dark(var(--color-gray-80), var(--color-gray-20));
++      background-color: light-dark(var(--color-gray-80), var(--color-gray-40));
    }

The suggestion passes WCAG AAA: 7.14:1 7.39:1

@mdn/content-team Do you approve the changes in this PR, and/or Onkar's suggestion?

@caugner caugner added the needs content decision This issue needs a decision from the MDN Content Team before it can proceed. label Sep 1, 2025
@Rumyra
Copy link
Contributor

Rumyra commented Sep 2, 2025

Yes approve both 👍

@caugner
Copy link
Contributor Author

caugner commented Sep 3, 2025

I looked into applying @OnkarRuikar's suggestion, but noticed that all neutral dark variants have similar contrast issues, see the following screenshots, with hover on the middle button:

image image image image

Here's how these would look with increased contrast (1120399):

image image image image

@Rumyra Does that look right?

Edit: Contrast ratios are 12.35:1 and 7.39:1 respectively, both passing WCAG AAA.

@OnkarRuikar
Copy link
Contributor

@caugner thanks for increasing the scope of the fix. The dark theme is looking good.

img
In the Light theme could you increase darkness a bit more? I am using a LED screen and the hovered unhovered difference is not that stark.

@caugner
Copy link
Contributor Author

caugner commented Sep 3, 2025

In the Light theme could you increase darkness a bit more?

I assume you're referring to this one:

image

Here's how this looks with increased "hover contrast" (34c264c):

image

Contrast is 7.39:1 (previously 13.25:1), still passing WCAG AAA.

@caugner caugner changed the title fix(button): increase contrast for light action buttons fix(button): increase hover contrast Sep 3, 2025
@caugner
Copy link
Contributor Author

caugner commented Sep 3, 2025

I'm thinking that we shouldn't mix these changes up in a single PR:

  • The original changes are increasing contrast between text and background color.
  • The other changes are decreasing contrast between text and background color, to increase contrast between background color with/without hover.

@OnkarRuikar
Copy link
Contributor

OnkarRuikar commented Sep 3, 2025

There are other places that could use more hover contrast:

hoverContrast.mp4

Also include the search box suggestion list and left sidebar list. In right sidebar in-viewport items could use more prominent blue background.

@caugner caugner marked this pull request as draft September 3, 2025 13:52
@globau globau removed the needs content decision This issue needs a decision from the MDN Content Team before it can proceed. label Sep 10, 2025
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

Successfully merging this pull request may close these issues.

Insufficient color contrast in footer

4 participants