Listen to this article
Take the story with you. Choose a voice and a pace that suits you.
Or listen in another language / choose a voice
Getting your device voices ready…
The voice follows the displayed language and your browser’s regional preference when available. You can choose another narration voice.
Press Tab on your own site. Keep pressing it. At some point the little outline will vanish — behind a sticky header, against a dark hero, or nowhere at all because a reset stylesheet killed it. That disappearing act is what learning how to design accessible focus states is meant to stop. For a sighted person moving by keyboard, the focus ring is not decoration. It is the cursor. Lose it, and they have lost their place.
I say this as someone rebuilding his own site by hand. Focus is the state I used to leave until last.
Start with the WCAG focus indicator requirements
The rules are spread across several criteria, which is why teams misread them. The W3C’s guidance on Focus Visible puts the baseline plainly: any keyboard-operable interface needs a mode where the focus indicator is visible, and stays visible while the element holds focus. That is Success Criterion 2.4.7, Level AA. On its own it says nothing about size or colour.
The numbers come from its neighbours. As Level Access sets out in its breakdown of the WCAG focus indicator requirements, an indicator needs at least 3:1 contrast against adjacent colours under 1.4.11 Non-text Contrast, also Level AA. WCAG 2.2 added 2.4.11 Focus Not Obscured (Minimum): the focused element must not be entirely hidden by sticky headers or banners. Then 2.4.13 Focus Appearance, Level AAA, asks for an indicator area at least as large as a two-CSS-pixel-thick perimeter around the component.
Treat 2.4.13 as a design target anyway: a 3px outline clears its two-pixel perimeter, costs nothing, and reads at a glance. Design against numbers, not adjectives. Three pixels at 3:1 can be tested. “Clear and obvious” cannot.
How to design accessible focus states, step by step
Start with one indicator, defined once, for the whole site. A dedicated token helps: a focus colour chosen for contrast against your surfaces, not your brand colour borrowed out of habit. Brand colours are picked for your main background. Focus has to survive every background — a pale footer, a photograph, a dark panel, a coloured button.
That last case breaks single-colour rings. A dark ring that passes on white can disappear on a dark section; a light ring does the reverse. The sturdy answer is a two-tone indicator: a dark outline paired with a light band. If the two tones contrast strongly, at least one will stand out against any solid background. Build the pair once.
Shape matters too. Use outline, not border: a border takes up space, so the layout twitches when focus lands. An outline sits outside the box, follows rounded corners, and leaves the layout alone. Add a small offset, around 2px, so the ring clears the control’s own edge.
Keep the treatment consistent. A ring on buttons, an underline on links and a glow on cards forces a person to relearn what focus looks like every few Tab presses. Deque makes the same point about consistency: focus is a pattern like any other in your system, and it should hold together across the page.
Use focus visible CSS, not a global outline reset
Most broken focus states start with one line: outline: none. Someone saw the browser ring appear after a mouse click, filed it as a bug, and a developer removed it everywhere. The ring stopped annoying pointer users — and stopped existing for keyboard users.
Focus visible CSS solves the original complaint without that trade. The :focus-visible pseudo-class applies your indicator when the browser judges focus needs to be seen, which in practice means keyboard input, not an ordinary mouse click. Text fields are the sensible exception: browsers show it there on click too, because a person needs to know where their typing will land.
A working pattern is short:
:focus-visible { outline: 3px solid your dark tone; outline-offset: 2px; box-shadow: 0 0 0 5px your light tone; }
Pair it with a narrow suppression rule, :focus:not(:focus-visible) { outline: none; }, so pointer focus stays clean while keyboard focus keeps the full indicator. Never leave a bare outline: none standing alone. If a component overrides the global rule, its own indicator belongs in the same rule, at the same contrast. Search your stylesheet for outline: none now and then. Every hit is either a bug or a decision that should be written down next to it.
Test it the way keyboard navigation UX design demands
Automated checkers can spot a missing outline. They cannot tell you whether a ring is legible over your hero image, or whether Tab order makes sense. That judgement is manual — and it is where keyboard navigation UX design earns its name.
Unplug the mouse, or put it out of reach. Tab from the top. At every stop you should be able to answer: where am I, and what happens if I press Enter? Watch for three failures. Focus that disappears behind the sticky header — fixed by adding scroll padding at the top of the page. Focus in the wrong order, leaping from header to footer because visual layout and code order disagree. And custom controls built from plain divs that never receive focus at all. A native button enters the tab order for free; a hand-built one needs that work done deliberately, and a positive tabindex value is not the way — it scrambles the sequence for everyone after it.
Test on every background the component sits on, in light and dark themes if you have both. Then test the long form, the menu, the modal — focus inside a modal should stay inside it and return to where it started when it closes. Twenty unhurried minutes and a keyboard will do.
A focus ring will never be the part of a design anyone compliments. But the person tabbing through your checkout at magnification, or with a switch device, experiences your site through that ring alone. Design it like it is the interface — because for them, it is.






