Website Spec
← Accessibility
Required

Visible focus indicators

Whenever a control receives keyboard focus, the page must show a clear, high-contrast indicator. Removing focus outlines without a replacement is a top accessibility failure.

What it is

A focus indicator is the visible cue that tells a keyboard user which control will receive their next keystroke. Browsers ship one by default — usually a thin outline ring. WCAG 2.4.7 (Level AA) requires the active focus location to be visible at all times when navigating by keyboard.

WCAG 2.2 added two more rules. 2.4.11 (AA) requires that the focused element is not entirely hidden behind sticky headers or cookie banners. 2.4.13 (AAA) sets minimum size and contrast for the focus indicator itself.

Why it matters

Without a focus ring, a keyboard user is navigating blind — they tab three times, do not know where they are, and give up. The single most common cause is a stylesheet that hides the default ring to "tidy up the design":

/* Don't ship this. */
*:focus { outline: none; }

This is a Level AA failure. If you remove the default style, you must replace it with something equal or better.

How to implement

Use :focus-visible so the focus style appears for keyboard users but not for every mouse click on a button:

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #0b5fff;
  outline-offset: 2px;
  border-radius: 4px;
}

Guidelines:

:focus-visible is supported in every current browser. If you need to support older engines, pair it with :focus as a fallback.

Common mistakes

Verification

Sources