Accessibility Certified – Home

2.4.7 Focus Visible

Anything that can be operated by keyboard must show a visible focus indicator when it has keyboard focus.

Level AAPrinciple 2: Operable

What does it mean?

Keyboard users need to see where they are on the page, just as mouse users see the pointer. Browsers show a focus outline by default, but many designs remove it with outline: none and replace it with nothing. Then a keyboard user is effectively working blind.

Every focusable element (links, buttons, form fields, custom widgets) must show a visible indicator while it has keyboard focus. Using :focus-visible lets you show a strong indicator for keyboard users without showing it on every mouse click. The indicator should also have enough contrast against its surroundings (see 1.4.11).

Who does it help?

  • Sighted keyboard users, including many people with motor impairments
  • People with low vision or attention difficulties who need to keep track of their position
  • Users of switch devices and other keyboard-emulating tools

Common failures

  • A global CSS reset with *:focus { outline: none; } and no replacement
  • A focus style that only changes the colour very slightly, so it cannot be seen
  • Custom buttons or cards where the focus style is cut off by overflow: hidden on a parent
  • A focus indicator in the same colour as the background

How we test it

  • evidence Evidence: our scanner collects material such as screenshots, lists and measurements.

Test question: Is the keyboard focus always clearly visible? Elements without a detected focus style are flagged.

A person decides every criterion. No criterion ever passes automatically.

How to fix it

Problem
*:focus { outline: none; }
Better
:root { --focus: #1a56db; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* also visible in Windows high contrast mode */
@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
}

A thick, offset outline appears for keyboard focus on every element and adapts to forced-colours mode.

Practical tips

  • Prefer outline over box-shadow for focus: outlines stay visible in forced-colours (high contrast) mode.
  • Check dark sections and images separately; one focus colour may not work on every background.

Guides and patterns on this

Official source

Understanding WCAG 2.2 at the W3C: 2.4.7 Focus Visible

How does your website do on this criterion?

The free check tests your home page automatically; the audit decides all 55 criteria.

Free checkAll criteria