Visible keyboard focus indicator

Why keyboard users must see which link or button is selected, how the scan compares styles before and after a Tab press, and how to add a clear focus style.

What AuditX checks

The scan opens the page you scanned in a real browser at 1440 by 900 pixels, with animations and transitions switched off, and presses the Tab key the way a keyboard user would. It finds up to the first 4,000 links, buttons, form fields, frames, summary elements and other focusable elements that are visible, not disabled and not set to tabindex="-1". It presses Tab three times per element found, never fewer than 6 and never more than 60 times. From the part of the tab order that Tab can reach, it picks up to 8 elements spread evenly as samples. For each sample it compares the styles before and after the element gets focus: outline, box-shadow, the four borders, background colour, text colour and underline. It does this for the element itself, for up to 4 parent elements above it, for the first 32 elements inside it and for their ::before and ::after content, where it also compares size and transform, so an underline that grows in on focus counts. It fails when at least one sample looks exactly the same when focused (when every tested element sits in a cookie or consent banner that kept focus, the message says so, and that the rest of the page was not tested), and it says how many of the tested elements show no change and names up to three of them by tag, id or first class name and their text, so you can tab to them yourself. It also fails when a sample takes focus while it is invisible: it, or a menu or panel around it, has opacity 0 and takes no clicks (form fields are left out). It passes when every tested element is visible and changes. It gives an info note, which does not lower the score, when the page has no focusable element, when no element could be sampled or when none could be compared reliably. If the browser is not available, or the measurement fails even after one retry, the check is shown as not measured and is left out of the score. Only the sampled elements on this one page are tested. The scan does not judge how thick or how strong in contrast the indicator is, and it can miss an indicator drawn with a filter, a transform on the element itself, an SVG stroke or a script that changes something elsewhere on the page.

Why it matters

Some people use the Tab key instead of a mouse, for example because of a motor disability or an injury. The browser has to show them which link or button is selected, like a cursor does for a mouse. If the page hides that, they cannot tell where they are.

WCAG success criterion 2.4.7, Focus Visible, is a Level AA requirement. It says that any interface that can be used with a keyboard must have a mode in which the keyboard focus indicator is visible.

How to fix it

  1. Search your CSS for outline: none or outline: 0 on links, buttons and form fields. If you find one, remove it, or add a replacement focus style next to it.
  2. Add a clear style that only shows during keyboard focus, using the :focus-visible selector. A 2 pixel outline with a small offset is a simple choice.
  3. Pick a colour that stands out from the background around the element. If your page has both light and dark areas, test both.
  4. If the report names links in a closed menu or panel, hide that panel with visibility: hidden or display: none instead of only opacity: 0, or open it while focus is inside it with :focus-within.
  5. Test it yourself: click in an empty part of the page, press Tab again and again, and watch. You should always be able to see which element is selected.
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #1a56db;
  outline-offset: 2px;
}

Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.

Scan my site

Sources

Related checks

Last reviewed 2026-11-13.