Rule

Visible focus

Keyboard focus must remain visible.

Rule
focus-visible
WCAG 2.2
2.4.7 Focus Visible (opens in a new tab) (Level AA)
Severity
Serious

What it checks

Reads the page's stylesheets and style attributes for anything that takes the focus outline away: outline: none or outline: 0 in a rule for :focus or :focus-visible, in a rule with no focus state that reaches something Tab lands on, such as a { outline: none }, or in the style attribute of a focusable element.

A focus rule is cleared when it draws a replacement itself, such as a box shadow, border, background or underline, or when a later rule in the same stylesheet gives the same elements a visible outline or replacement on focus. A rule with no focus state is cleared when a focus rule that outranks it restores the ring. The pattern :focus:not(:focus-visible) { outline: none } is never counted, since it keeps the ring for keyboard users.

When a person decides

Findings are sent for review, never failed. A stylesheet from another origin cannot be read, and an indicator can be drawn in ways this scan does not follow, such as on a parent with :focus-within. A person tabs through the page to check focus stays visible.

Example

Sent to review

<style>
  a:focus { outline: none; }
</style>
<a href="/menu/">Menu</a>

Passes

<style>
  a:focus { outline: none; box-shadow: 0 0 0 3px #1a5fb4; }
</style>
<a href="/menu/">Menu</a>

The engine is tested against both examples.

How to fix it

Remove outline: none, or draw a clear replacement on :focus-visible, such as an outline or a box shadow ring in a contrasting colour.

Check your own pages

This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.