Search topics
Low-contrast focus rings against the background
The focus ring is drawn in a colour too close to what sits next to it: the text colour at half strength on white, or the brand blue on a blue band.
outline: 2px solid #1a4fd0 The problem
People with low vision can't find which link or button keyboard focus is on
A store has a white header with its menu links, and under it a blue band, "Free delivery this week", with two white buttons. Every link and button shows a focus ring when you Tab to it, so focus is never missing. It is hard to see in one of two common ways.
In the first, the ring is the text colour at half strength, a pattern some shop themes use. On the band, where the text is white, the ring is a light blue-grey that stands out well enough. In the white header, where the text is a dark grey, it comes out as a pale grey hairline around the link.
In the second, the ring is the brand blue. In the header it is clear. Around the band's buttons it sits on the band's own deep blue, and you have to look hard to tell which button has it.
WCAG 1.4.11 Non-text Contrast asks for 3:1 between the visual information needed to identify a state, which includes the focus indicator, and the colours next to it. A ring drawn outside a control sits on the surface around the control, so that surface is what it is measured against. A ring drawn inside the control is measured against the control's own fill.
- The half-strength ring is
rgb(67 67 67 / 0.5). Blended with the white header, it is#a1a1a1, at 2.58:1. With near-black text the same pattern can pass, which is why it goes unnoticed: the ring is only as strong as the text colour it is taken from, and a softer grey for the text drops the ring under 3:1. - The brand ring is
#1a4fd0. It is 6.83:1 on the white header, but on the#12348fband it is 1.61:1.
Both rings were checked against one surface only, if at all: the first against a text colour that later changed, the second against the white page it was designed on.
The same happens to anyone on a glossy phone screen in daylight, or a dim laptop, where a low-contrast ring is the first thing to go.
2 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 (not affected)
- Seizures (not affected)
- Limited vision People with low vision, or with reduced contrast sensitivity, scan the page for the ring and pass over a pale grey or a blue on blue. With magnification only part of the page shows, so a faint ring is easy to lose.
- Limited manipulation Keyboard users who look away and back have to hunt for where they are before pressing Enter, and can follow the wrong link when the ring barely shows.
Scanners that read the stylesheet, such as axe, don't focus anything, so they never see a focus ring. The audit does: it focuses up to 25 controls on each page, compares a picture of each before and after, and measures the strongest change against the colour that was there before. That finds both Befores here, the pale grey on white and the blue on the band. A control that only appears later (in a menu, a dialog or the next slide) is not reached, and a ring only a hover state draws is not measured. A ring picked in a design tool or written by an AI may be checked only against the page colour in the mock-up, which is how the brand ring passes on white and fails on the band.
Try it
Press Tab through the header links and the buttons on the blue band
Broken 1: the ring is the text colour at half strength. On the band it shows; around the white header’s links it is a pale grey line.
Broken 2: the ring is the brand blue. Clear in the header; around the band’s buttons it sits on the band’s own blue.
Apply a fix. Tab through both surfaces again: the ring stands out on each.
Broken Can you fix this?
Free delivery this week
The fix
Give the focus ring 3:1 against every surface it sits on
A ring in the text colour at half strength
:root { --ink: 67 67 67;}.sale-band { --ink: 255 255 255; background: #12348f;}.site-header,.sale-band { color: rgb(var(--ink));}.sale-band .button { background: #fff; color: #12348f;}:focus-visible { /* The text colour at half strength */ outline: 2px solid rgb(var(--ink) / 0.5); outline-offset: 2px;}What is wrong3 points
- The ring takes its colour from the text, at half opacity, so its contrast depends on how dark the text is.
- In the white header it blends to
#a1a1a1, at 2.58:1 against the white around it. - On the band it blends to
#899ac7, at 3.92:1, so the fault shows only on white.
A ring per surface
:root { --ink: 67 67 67; --focus-ring: #1a4fd0;}.sale-band { --ink: 255 255 255; --focus-ring: #fff; background: #12348f;}.site-header,.sale-band { color: rgb(var(--ink));}.sale-band .button { background: #fff; color: #12348f;}:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px;}How it is fixed3 steps
- Add a
--focus-ringtoken, solid and not translucent, set to the brand blue on the page: 6.83:1 against white. - Set the token again on the band, to white: 10.97:1 against
#12348f. - Draw the ring from the token, so each surface gets the colour checked for it.
This fixes both Befores and passes 1.4.11 on the two surfaces set here. Every new surface, such as a dark footer or a coloured card, needs its own value and its own check.
All three pass 1.4.11 on this page. The ring per surface keeps one clean brand colour and costs a token value and a check for every surface the components sit on. The two-tone ring is one rule for every surface that contrasts with either the blue or the white, at the cost of a heavier look. Technique C40 takes the same idea further: with its two colours 9:1 apart, such as white and a near-black, every possible background contrasts with one of them. The ring inside the button suits a band whose controls are all light buttons, and it needs no colour of its own, but it covers only those buttons; anything else on the band still needs a ring per surface or the two-tone ring. Choose by how many surfaces your controls sit on, and whether editors can add new ones.
Where the ring sits decides what it is measured against. An outline with a positive outline-offset sits on the surface, so a brand-coloured button on a white page can use a brand-coloured ring: the ring is measured against the white, not the button. A ring that straddles the control's edge, partly inside and partly outside, needs 3:1 from only one of its two parts. A ring inside the control, as some themes draw for links in a header or arrows in an announcement bar, is measured against the control's fill.
A translucent ring, such as a colour at half opacity or a framework's soft glow at a quarter of the brand colour, has no fixed contrast: it blends with what is under it. Measure the colour it ends up as, on each surface, or make the ring solid. The same goes for a ring set as a box-shadow alone, which a contrast theme also removes; keep an outline, as high contrast mode hiding focus, icons and selections explains.
A white halo or a ring outside the control can be cut off by overflow: hidden on a parent, such as a carousel track or a scrolling row of cards. Leave room around the control, or use the inside ring there. A dark theme needs its own ring values too, as dark mode with faint grey text and icons shows.
This guide is about the ring's colour against what is next to it. A control with no ring at all is missing focus indicators, and a ring too thin to find, or too close to the colour it replaces, is the stricter AAA test in focus rings too thin or faint to spot. Field borders, checkboxes and icons are in low-contrast form fields, checkboxes and icons.
Verify the fix
4 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 theme tokens, the surfaces or shared component styles change.
Limits
This is a starting pattern, not a guarantee for every application. The colours and token names are examples; measure your own ring on your real surfaces. A ring that reaches 3:1 can still be hard to find if it is thin, and 2.4.13 asks for more, as the focus appearance guide explains. Test the complete journey with people who rely on the ring.
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.