Search topics
Focus rings too thin or faint to spot
A 1-pixel, pale blue outline technically shows focus, but it is too small and too close to the page colour to find at a glance.
outline: 1px solid #a8c7fa The problem
People with low vision can't find a focus ring that is a pale hairline
Tab through a row of blue buttons on a white page, then through the same buttons on a dark navy banner. Each button gets a focus ring, so focus is technically visible. But the ring is a single pixel of pale blue. On the white page it almost disappears; on the banner it shows, but as a hairline you have to look for.
Success criterion 2.4.13 Focus Appearance (AAA) asks two things of an indicator the author has styled. It must cover at least the area of a 2 CSS pixel thick ring around the unfocused control. And the pixels that change must have at least 3:1 contrast between their focused and unfocused colours. The ring here is 1 pixel thick, so it fails the area test on every surface. On the white page, #a8c7fa against #ffffff is 1.72:1, so it fails the contrast test too.
This is a stricter test than 2.4.7, which only asks that focus be visible, and a different one from 1.4.11, which asks for 3:1 against adjacent colours. The 2.4.13 contrast is a change of state: compare each pixel with what it was before focus.
Anyone with a dim or glary display is affected too.
3 of 10 groups affected
- No vision (not affected)
- Low vision (affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (not affected)
- No speech (not affected)
- Motor (affected)
- Reach, strength (not affected)
- Cognitive (affected)
- Seizures (not affected)
- Limited vision People with low vision and people using magnification who only see part of the screen struggle to spot a hairline ring. Older users with reduced contrast sensitivity are affected even with corrected vision.
- Limited manipulation Keyboard users who look away and back need to find their place again quickly, and a hairline ring makes that slow.
- Limited language, cognitive and learning abilities People with attention or short-term memory limitations rely on seeing where focus is to keep their place, and a ring they have to hunt for loses it for them.
Most scanners only check that focus changes something, which this ring does. Measuring the 2.4.13 area needs the control's perimeter and the indicator's thickness; measuring its contrast needs the before and after colours of the same pixels, on each surface. Generated code tends to copy a framework's thin default ring, or add box-shadow alone, which forced colors removes.
Try it
Press Tab and try to spot the focused button
Press Tab to move through the buttons on the white page and the navy banner.
Broken Can you fix this?
The fix
Draw focus at least 2px thick, with 3:1 contrast
.brand-button:focus-visible { outline: 1px solid #a8c7fa; outline-offset: 2px;}What is wrong2 points
- Focus is barely visible. The ring is 1 pixel thick, half the 2 pixels required.
- On a white page the ring fades into the background. Its pale blue is only 1.72:1 against the white it replaces, where 3:1 is needed.
A solid 2px ring for each surface
.brand-button:focus-visible { outline: 2px solid #1a5fb4; outline-offset: 2px;}/* On the navy banner, the blue would be 2.45:1, so switch to white. */.banner .brand-button:focus-visible { outline-color: #fff;}How it is fixed3 steps
- Make the ring 2 pixels thick, outside the button. Its perimeter is larger than the button's, so its area is more than enough.
- Colour it
#1a5fb4, which replaces white on the page at 6.29:1. - On the navy banner, where the blue would be 2.45:1, switch the ring to white, which replaces
#0b2545at 15.39:1.
This fixes the Before and passes 2.4.13, but only on the surfaces you have set a colour for: each new background needs its own check and, often, its own rule.
Each of the three passes 2.4.13. The ring per surface matches the brand closely but needs a colour and a check for every background. The two-tone ring needs one rule for any surface, including user themes and editor-chosen colours, and looks heavier. The fill change suits designs that don't want a ring, but every button style needs its own pair of colours, and the focused state must not look like the hover or pressed state. Choose by how many surfaces your buttons sit on and how much the design can change.
The 2-pixel rule is an area, not a stroke width. An outline outside the control has a longer perimeter than the control, so 2 pixels is enough. An inset indicator, drawn inside the edge, has a shorter perimeter and needs to be thicker to cover the same area. A ring with gaps, dashes or rounded corners also covers less; measure it rather than assuming.
Only the pixels that change count. A ring that is half on the button and half on the page needs 3:1 against each colour it replaces. A grey ring that differs from the page by 3:1 but sits on a grey card may not.
overflow: hidden on a parent can cut off part of an outside ring. Leave space around controls, or use outline-offset with a negative value and a thicker ring. The criterion's exception covers focus indicators that the browser draws and the author has not changed. Relying on the browser default is allowed, but browsers draw different rings, and many sites override them anyway.
Put the ring in a design token or a shared component style, so a theme change cannot quietly thin it again.
Design ideas
There is more than one way to show focus clearly
Four more ways to show which of the guide’s buttons has focus. Press Tab to move through them: two you can spot at a glance, and two you have to hunt for.
In the design file
- Draw the focus state on each background the button sits on, the white page and the dark blue banner, separate from hover and pressed.
- Draw the focus ring 2 pixels thick and 2 pixels outside the button, or 3 pixels thick if it sits inside.
- Write the ring’s contrast ratio against the colour behind it, at least 3:1. The example has 6.29:1 for blue on white and 15.39:1 for white on dark blue.
- If focus is shown by a shadow or a fill, also draw an outline, because a Windows contrast theme removes shadows and fills.
Passes
- White line inside the pill A 3px white line just inside the blue edge, 6.29:1 against the blue it replaces. A line drawn inside needs that third pixel to match a 2px ring outside, and in return it takes no room in the layout and no tight container can clip it.
- Thick bar under the word A 6px #1a5fb4 bar along the bottom of the focused word, 6.29:1 against white. An 80 by 32 pixel button needs 448 square pixels of change, so the 3px bar many tab bars use covers only about half; at 6px the bar gives 480.
Fails
- Soft glowWCAG 2.4.13 A 4px halo of #c6d7ec, the button’s blue at a quarter strength: 1.47:1 against white, under the 3:1 needed. A contrast theme removes shadows, so there it shows nothing at all.
- Word that only turns blueWCAG 2.4.13 Focus turns the word from #1a1a1a to #1a5fb4, just as hover does. Only the letters change, at 2.77:1, and they cover far less than a 2px ring would.
Verify the fix
5 checks, no mouse.
Test with: Contrast measurement, Keyboard, Zoom, Forced colors
Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared theme or component styles change.
Limits
2.4.13 is a AAA criterion, so most conformance targets don't require it. It is still the clearest test of whether focus is easy to see, and a ring that passes it also passes 2.4.7; 1.4.11, which measures the ring against the colours beside it, is a separate check, covered in low-contrast focus rings against the background. The colours here are examples; measure your own. Test the complete journey on your real surfaces.
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.