Skip to content
easeweb
Search topics

High contrast mode hiding focus, icons and selections

The chosen option is shown only by a background fill, the focus ring is a box shadow and the icon has a fixed fill, so a contrast theme removes all three.

Best practice
No WCAG criterion requires it
Related WCAG 2.2
SC 1.4.11AA· new in 2.1
Required by
Not required by Section 508 or EN 301 549
Broken input:checked + label { background: #1a1a1a; }
The accessibility problem illustrated: Low vision:Which size did I pick?
01

The problem

People who use a contrast theme can't tell which size is chosen, where focus is, or that the save button is there

02

Try it

Turn the contrast theme on, choose a size, then press Tab

The switch draws the page as a dark Windows contrast theme would. Can you still see which size is chosen, where focus is, and the save button?

Simulate Dark contrast theme (simulated)

Broken Can you fix this?

BrokenState, focus and icon drawn only in the page's colours

Merino crew jumper

Oat · 89.00

Size

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep focus, state and icons visible in a contrast theme

Before
BrokenState, focus and icon drawn only in the page's colours
<fieldset class="sizes">  <legend>Size</legend>  <input type="radio" name="size" id="size-m" value="m" checked>  <label for="size-m">M</label>  …</fieldset><button class="save" aria-label="Save to wishlist">  <svg viewBox="0 0 24 24" aria-hidden="true">    <path fill="#1a1a1a" d="…"/>  </svg></button>
What is wrong3 points

In the shop's colours each of these passes 1.4.11. Under a contrast theme the fill, the shadow and the icon's contrast are exactly what goes, so the state, the focus and the button are lost together.

  • The chosen size looks like every other chip. It is marked only by the label's dark background, and the theme removes that background.
  • No ring appears on the chips or the heart when they have focus. Focus is a box-shadow with outline: none, and the theme removes the shadow.
  • The save button itself disappears. The heart's path is filled with a fixed #1a1a1a, which stays near-black on the theme's black canvas.
After

Styles a contrast theme keeps

<fieldset class="sizes">  <legend>Size</legend>  <input type="radio" name="size" id="size-m" value="m" checked>  <label for="size-m">    <svg class="tick" viewBox="0 0 24 24" aria-hidden="true">      <path        fill="none"        stroke="currentColor"        stroke-width="3"        d="M5 12l5 5 9-10"      />    </svg>    M  </label>  …</fieldset><button class="save" aria-label="Save to wishlist">  <svg viewBox="0 0 24 24" aria-hidden="true">    <path fill="currentColor" d="…"/>  </svg></button>
How it is fixed3 steps
  1. Add a tick to each label, drawn with stroke="currentColor", and show it only on the checked label. It shows in every palette, and it tells colour-blind visitors which size is chosen too.
  2. Draw focus as an outline instead of a box-shadow. The theme draws it in its own focus colour.
  3. Fill the heart with currentColor and give the button its color, so the heart follows the button's text colour wherever it goes.

A contrast theme recolours borders, outlines and the text colour rather than removing them, so the state, the focus and the button all stay. This fixes the Before in every contrast theme.

04

Verify the fix

5 checks, no mouse.

Test with: Forced colors, Keyboard, Contrast measurement

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after shared component styles or the icon set change.

Limits

This is a starting pattern, not a guarantee for every application. Contrast themes differ between Windows versions and browsers, and Firefox's own colour override behaves slightly differently again. Normal-colour contrast is a separate requirement, covered in low-contrast form fields, checkboxes and icons. Test the complete pages with people who use a contrast theme every day.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service