Search topics
Missing focus indicators
A reset removes the outline and leaves no visible replacement.
The problem
Keyboard users can't see where they are on the page
Tab across a row of actions on a branded surface. Each control receives focus, but only the pointer hover state changes its appearance. The keyboard position is invisible.
Browsers draw a focus ring by default. The stylesheet removes it with outline: none and puts no :focus-visible rule in its place, and the browser adds no other cue by itself. Success criterion 2.4.7 Focus Visible asks that people using a keyboard can see where focus is. Here they can't, on the light page or on the dark banner.
This is especially confusing around destructive or repeated controls.
2 of 10 groups affected
- No vision (not affected)
- Low vision (not 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 manipulation Keyboard users must guess which action Enter will trigger.
- Limited language, cognitive and learning abilities People with attention or short-term memory limitations lose track of where focus is, and with no indicator they have nothing to find it with again.
DOM semantics can be correct while the focused appearance remains unusable. A scanner may not exercise every background or clipping container. A generated outline colour may work on white and disappear on a branded surface.
Try it
Press Tab and watch the buttons
Press Tab to move through the buttons on both backgrounds.
Broken Can you fix this?
The fix
Bring back a focus ring that shows on every surface
*:focus { outline: none;}.brand-button:hover { background: var(--brand-dark);}What is wrong2 points
- Keyboard users can't see where focus is: the reset removes the browser's indicator from every control, and nothing replaces it.
- A control that takes focus looks just as it did: the hover style responds only to a pointer, not to keyboard focus.
A ring for each surface
.brand-button:hover { background: var(--brand-dark);}.brand-button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px;}/* On the dark banner, switch to a ring that contrasts with it. */.banner .brand-button:focus-visible { outline-color: var(--focus-ring-on-dark);}@media (forced-colors: active) { .brand-button:focus-visible { outline-color: Highlight; }}How it is fixed4 steps
Delete the reset rather than overriding it control by control, then add a visible indicator.
- Draw the ring on
:focus-visible. It shows when focus comes from the keyboard without adding it to every mouse click. - Colour it with a contrast ratio of at least 3:1 against the surface it sits on, the threshold 1.4.11 Non-text Contrast sets for a focus indicator.
- On the dark banner, switch to a ring colour that contrasts with it. One colour rarely works on both a light page and a dark banner.
- In forced colors, draw the ring in
Highlight.
This fixes the Before and passes 2.4.7.
A ring per surface can match the brand more closely, but each new surface needs its own colour and its own check. The two-tone ring works on any surface with one rule, at the cost of a heavier look. If buttons can appear on many surfaces, on user-chosen themes, or on colours editors pick, start with the two-tone ring.
A working ring can still be lost after it is drawn. Each of these hides it in a different way.
overflow: hidden: can clip the outline. Leave enough space around controls or revise the clipping container.- Forced colors: a box shadow alone may disappear, so keep an outline even if you add a shadow.
- Sticky headers and cookie banners: can cover the focused control. Add
scroll-padding-topfor sticky content.
Do not infer conformance from a single screenshot. Inspect focused states in the actual page, on every background the control appears on.
Design ideas
Pick the focus colour for every surface, not just one
Three ways to colour focus for buttons on a white page and a dark banner. Press Tab to move through them: two stay visible on both, and one disappears on the banner.
In the design file
- Draw the focused button on every background it sits on, the white page and the dark banner, not only the one in the main mock-up.
- Choose one focus colour that reaches 3:1 on every surface, or name one token per surface, such as focus-on-light and focus-on-dark.
- Write each ring’s contrast ratio against the surface behind it. The example’s mid blue has 4.20:1 on white and 4.29:1 on the banner.
Passes
- One mid-blue ring for both surfaces A 3px #1c7ed6 ring, dark enough for the page and light enough for the banner: 4.20:1 on white and 4.29:1 on #051827. A colour halfway between the two surfaces lets one token cover both.
- Outline pill that fills on focus Focus fills the pill with its own line colour: navy on the page, 16.42:1 against white, and white on the banner, 18.00:1 against #051827. Hover only tints it, so focus still looks different from hover.
Fails
- Brand navy ring everywhereWCAG 2.4.7 One 3px #0d2131 ring for every surface: 16.42:1 on the white page, 1.10:1 on the #051827 banner, where focus disappears. A colour checked only on the page it was designed on fails on the next surface.
Verify the fix
4 checks, no mouse.
Test with: Keyboard, Screen reader, 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
This is a starting pattern, not a guarantee for every application. Token names in the snippets are placeholders for your own design tokens. This guide covers focus with no ring at all; for a ring that is there but too thin or faint to find, see ways to draw a focus indicator that passes; for a ring whose colour is too close to the background, low-contrast focus rings against the background; and for a scroll box that Tab never reaches at all, scrollable areas that a keyboard can't scroll. 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.