Page MenuHomePhabricator

Destructive normal and quiet buttons fail WCAG AA contrast
Closed, ResolvedPublic1 Estimated Story Points

Description

Background goal

While Red600 - #d33 (destructive) works with White - #fff, it doesn't work on any of our greys, failing contrast ratio requirements slightly (f.e. 4.33 (foreground color: #d33, background color: #f8f9fa).

Current destructive buttons - #d33.png (808×3 px, 94 KB)

Considerations

  • If we update the Red600 this would affect to:
    • Destructive button (primary, normal and quiet)
    • Red link
    • Inline error messages (e.g. error form Field)
    • Error messages and Error InfoChips (icon uses color-error)

Final proposal

We will update color-Red600 from #d33 to #d73333. This will affect any decision token using color-Red600.

Option 1 - #d73333 (as in OOUI).png (808×3 px, 89 KB)

Design spec

Acceptance criteria (or Done)

Design

  • Find a design-first way to resolve this special case
  • Create the design spec for the new color's decision and link it in this task
  • Update the Red600 color and decision tokens in the Design Tokens library

Code

  • Update color-Red600 from #d33 to #d73333
  • Update the hex in the Style Guide

Event Timeline

Since the current #d33 is not working on #F8F9FA and #EAECF0, I've included some possible solutions in the task description. Sharing them also here:

We could update the Red600 from #d33 to one of the following:

Option 1 - #d73333 (as in OOUI).png (808×3 px, 89 KB)
Option1: In OOUI we've swindled ourselves out by defining #d73333. This new red color works well on #F8F9FA but not on #EAECF0, so quiet-destructive buttons would not be enough contrasted on this gray.
Option 2 - #cb2929.png (808×3 px, 88 KB)
Option2: We could use #cb2929 so this new gray is enough contrast on both #F8F9FA and #EAECF0.

Apart from updating the destructive buttons, we need to keep into account that if we update the Red600 color this would affect to the following components:

  • Destructive buttons
  • Red links
  • Error form items (e.g. text input, select...)
  • Error messages and Error InfoChips (icon uses color-error)

According to the WCAG, large-scale text (with at least 18 point or 14 point bold) would not need the 4.5:1 but just the 3:1 contrast instead. So, since our buttons use 14px (desktop) and 16px (mobile) Bold text, we would not have any accessibility problem with the colors used there.

Captura de pantalla 2023-06-19 a las 18.48.02.png (440×2 px, 140 KB)

@RHo I think we can solve this task since it seems we don't need to finally update any of the colors used in buttons.

According to the WCAG, large-scale text (with at least 18 point or 14 point bold) would not need the 4.5:1 but just the 3:1 contrast instead. So, since our buttons use 14px (desktop) and 16px (mobile) Bold text, we would not have any accessibility problem with the colors used there.

Captura de pantalla 2023-06-19 a las 18.48.02.png (440×2 px, 140 KB)

@RHo I think we can solve this task since it seems we don't need to finally update any of the colors used in buttons.

Unfortunately "14 point" and "18 point" referenced in the guidelines are equivalent to 18.5px and 24px respectively, so this remains a valid a11y issue to solve.

There's a note on the W3C site [1] explaining the conversion:

Note 1: When evaluating this success criterion, the font size in points should be obtained from the user agent or calculated on font metrics in the way that user agents do. Point sizes are based on the CSS pt size as defined in CSS3 Values. The ratio between sizes in points and CSS pixels is 1pt = 1.333px, therefore 14pt and 18pt are equivalent to approximately 18.5px and 24px.

[1] http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html

Closing this task in favor of creating a new task once T337959: Accessibility audit: check the contrast ratio in our Codex components is complete. The destructive buttons failing WCAG AA contrast requirements is already captured there.

@CCiufo-WMF reopening this task as commented in T337959#8998290. Also updating title and task description to reflect both destructive normal and quiet buttons.

bmartinezcalvo renamed this task from Destructive normal buttons fail WCAG AA contrast to Destructive normal and quiet buttons fail WCAG AA contrast.Jul 10 2023, 3:03 PM
bmartinezcalvo updated the task description. (Show Details)

During the last Eng/Design sync, we decided the following to solve this task:

We will update color-Red600 from #d33 to #d73333. This will affect any decision token using color-Red600, so all main, normal and quiet destructive buttons will use this new color.

Option 1 - #d73333 (as in OOUI).png (808×3 px, 89 KB)

We will need to update the color tokens so sharing here the updated Figma spec.

NOTE: keep in mind that if we use a quiet destructive button on a #EAECF0 background, this would fail the contrast ratio required. So we should avoid to place quiet neutral buttons on these gray backgrounds.
bmartinezcalvo added subscribers: AnneT, egardner, Catrope.

@CCiufo-WMF this task is ready to be implemented, so moving to Needs Refinement in case we can include it in this or the following sprint. cc: @AnneT @egardner @Catrope

Catrope set the point value for this task to 1.Jul 21 2023, 5:56 PM
Catrope moved this task from Needs Refinement to Up Next on the Design-System-Team board.

Change 941023 had a related patch set uploaded (by Catrope; author: Catrope):

[design/codex@main] tokens: Slightly darken color-red600 to improve contrast

https://gerrit.wikimedia.org/r/941023

Change 941023 merged by jenkins-bot:

[design/codex@main] tokens: Slightly darken color-red600 to improve contrast

https://gerrit.wikimedia.org/r/941023

Change 944353 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/core@master] Update Codex from v0.15.0 to v0.16.1

https://gerrit.wikimedia.org/r/944353

Change 944353 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.15.0 to v0.16.1

https://gerrit.wikimedia.org/r/944353