The contrast problem

Beautiful, until someone has to read it.

What WCAG 2.2 requires, and exactly where typical soft UI falls short.

Measured

The numbers behind "low contrast"

  • Light gray text #a3b1c6 on a #e0e5ec surface measures 1.72:1. Normal text needs at least 4.5:1.
  • This site's own dark shadow, #b3bdcc, is only 1.56:1 against its surface. That's why the shadow can't be the only thing that shows where a button is.

Ratios calculated with the WCAG relative luminance formula.

What WCAG 2.2 asks for

  • WCAG 1.4.3: text needs 4.5:1

    WCAG 2.2 Success Criterion 1.4.3 (Level AA) requires at least 4.5:1 contrast for text and images of text. Large text, meaning 18 point or 14 point bold, needs at least 3:1, and W3C says not to round results up (4.499:1 fails).

    Source: W3C WAI, Understanding SC 1.4.3 Contrast (Minimum)

  • WCAG 1.4.11: controls need 3:1

    WCAG 2.2 Success Criterion 1.4.11 (Level AA) requires 3:1 contrast against adjacent colors for the visual information needed to identify user interface components and their states. Inactive components are exempt.

    Source: W3C WAI, Understanding SC 1.4.11 Non-text Contrast

  • Selected and focused states count too

    Under 1.4.11, the visual cue that shows a state, like selected or focused, also has to meet 3:1. That would apply to a neumorphic pressed look when it's the only visual sign of a toggle's state.

    Source: W3C WAI, Understanding SC 1.4.11 Non-text Contrast

  • A drop shadow isn't its own boundary

    When measuring non-text contrast, W3C treats a 3D drop shadow as part of whichever nearby color it's closest to in brightness. It doesn't count as a separate edge.

    Source: W3C WAI, Understanding SC 1.4.11 Non-text Contrast

  • A clear label can stand in for a border

    1.4.11 doesn't require a visible button boundary if the control has other visible content, such as text or a high-contrast icon, that shows it's there. A boundary is required only when nothing else identifies the control.

    Source: W3C WAI, Understanding SC 1.4.11 Non-text Contrast

  • WCAG 2.4.7: focus must be visible

    WCAG 2.2 Success Criterion 2.4.7 Focus Visible (Level AA) requires a visible keyboard focus indicator. W3C notes that without one, sighted keyboard users can't operate the page.

    Source: W3C WAI, Understanding SC 2.4.7 Focus Visible

  • WCAG 2.4.13: size and contrast of focus

    Success Criterion 2.4.13 Focus Appearance is Level AAA. The focus indicator must cover at least the area of a 2 CSS pixel thick perimeter around the unfocused component and change contrast by at least 3:1 between focused and unfocused states.

    Source: W3C WAI, Understanding SC 2.4.13 Focus Appearance

  • Outer shadows don't set the size

    For 2.4.13, W3C says a component's outline is based on its content, border and background. Shadow and glow effects outside the component don't count, so a soft outer shadow doesn't add to the area the focus indicator is measured against.

    Source: W3C WAI, Understanding SC 2.4.13 Focus Appearance

  • WCAG 1.4.1: don't rely on color alone

    WCAG 2.2 Success Criterion 1.4.1 Use of Color (Level A) says color can't be the only visual way to convey information, indicate an action or distinguish an element. W3C suggests adding shape or text.

    Source: W3C WAI, Understanding SC 1.4.1 Use of Color

What designers say