- Level
- AA
- Since
- WCAG 2.0
- Entries
- 99 / 193
2.4.7 Focus Visible
A person moving through the page with a keyboard must always be able to see which element has focus.
/ What it requires
Sighted keyboard users, including people with motor disabilities and anyone using a switch or voice control, steer by the focus indicator: the ring, underline or colour change that marks the current control. Without it they are pressing Tab blind. They cannot tell which link Enter will follow or which field their typing will go into, and the only way forward is to guess, or to watch the status bar for a URL.
The page passes when every element that can be operated by keyboard shows a visible indicator while it has focus. The default outline of the browser counts. At this level WCAG sets no minimum size or contrast for the indicator: criterion 1.4.11 asks for 3:1 contrast against adjacent colours for indicators the author has styled, and the AAA criterion 2.4.13 adds size requirements. A focus style applied with :focus-visible, which browsers show for keyboard use, passes.
/ How pages fail it
- A reset stylesheet sets outline: none or outline: 0 on :focus and nothing replaces it.
- The outline is removed on links and buttons only, so form fields show focus and everything else does not.
- The focus style exists but a parent with overflow: hidden clips it, so nothing is painted.
- A custom checkbox or radio button hides the native input, and the styled replacement has no focus state.
- The indicator has the same colour as the background it sits on, for example a white ring on a white page.
/ How to check it yourself
- Click in the address bar, then press Tab through the whole page. At every stop you should be able to point to the focused element without hesitation.
- Pay attention to the logo link, icon buttons, custom checkboxes, carousel arrows and the cookie banner, where indicators most often go missing.
- When focus seems to disappear, type document.activeElement in the DevTools console to find the element that has it.
- Search the CSS for outline: none and outline: 0 and check that each one has a replacement style on the same selector.
- Repeat with a Windows contrast theme switched on. Forced colours mode does not draw box-shadow, so an indicator made only of shadow vanishes.
/ How to fix it
- Delete outline: none from :focus rules, or pair it with a visible replacement on the same selector.
- Add a clear style such as :focus-visible { outline: 2px solid; outline-offset: 2px; } in a colour that stands out from the background.
- If the ring is drawn with box-shadow, keep outline: 2px solid transparent next to it so that forced colours mode still draws an outline.
- For custom checkboxes and radio buttons, style the visible replacement while the hidden input has focus, with a selector such as input:focus-visible + label.
- Look for a parent with overflow: hidden that cuts the outline off, and use a negative outline-offset or some padding to keep the indicator inside.
/ What our scanner checks
The check focus-not-visible runs in a real browser. It gives focus to up to 150 tab stops and compares what each element paints before and after: outline, border, shadow, background, text colour and decoration, and its ::before and ::after. If nothing changed, it reports the element. It cannot see an indicator drawn on a parent or sibling, and does not judge whether a change is strong enough to notice.
/ Who fails it, in our own measurements
One page per body, measured by automated checks on a weekly schedule. Any body that has fixed something since the last sweep will show it at the next one, and every entity page carries a right of reply.
/ Questions about this criterion
Is outline: none a WCAG failure?
On its own it removes the default focus indicator of the browser, and if nothing replaces it the page fails 2.4.7. W3C documents this as failure F78. It is fine when the same rule supplies another visible indicator, such as a border, a background change or a box-shadow, though a shadow alone disappears in forced colours mode.
What is the difference between :focus and :focus-visible?
The :focus selector matches whenever an element has focus, including after a mouse click. The :focus-visible selector matches when the browser decides an indicator is needed, which in practice means keyboard navigation and text fields. Styling :focus-visible keeps rings off buttons clicked with a mouse and still satisfies 2.4.7, because keyboard users get the indicator.
Does the focus indicator need a minimum contrast or thickness?
Not under 2.4.7, which only requires that it is visible. Contrast comes from 1.4.11 Non-text Contrast, which asks for at least 3:1 against adjacent colours when the author has styled the indicator. Size, and a 3:1 change between the focused and unfocused states, are set by 2.4.13 Focus Appearance, a level AAA criterion added in WCAG 2.2.
