WCAG 2.4.7 requires that anything you can operate with a keyboard shows a visible focus indicator, such as an outline or border, whenever it has keyboard focus. Most failures of this AA requirement come from CSS that removes the browser's focus ring without putting anything in its place.
On this page: the CSS line that causes most failures, what the rule asks, who needs it, failing and passing styles, real project failures, a quick test and its place among the newer focus rules in WCAG 2.2. For keyboard support itself, see keyboard access.
Quick facts
Level
AAAdded in
WCAG 2.0Principle
Operable, guideline 2.4 NavigableUsual cause
outline: nonewith no replacementCSS to use
:focus-visiblewith a thick outline and offsetFast test
Tab through the page and find the indicator at every stopRelated
2.4.11 Focus not obscured (AA), 2.4.13 Focus appearance (AAA)
One line of CSS that strands keyboard users
A designer sees a blue ring around a button after clicking it and asks for it to go. A developer adds outline: none to every element. The page looks cleaner, and every keyboard user loses track of where they are. They press Tab and nothing visible happens. They press Enter and something unexpected opens. This single line is behind most of the focus visible failures we find.
What WCAG 2.4.7 requires
Any part of the page that can be used with a keyboard must show a visible focus indicator when it has keyboard focus. W3C words it as "a mode of operation where the keyboard focus indicator is visible" (WCAG 2.2, 2.4.7). A focus indicator is the visual mark, usually an outline, underline, color change or border, that shows which item will respond to the next key press.
2.4.7 itself sets no size or contrast. The browser's default ring passes as long as you do not remove or hide it. The stricter measurements live in other criteria, covered further down.
"Mode of operation" means the indicator may appear only during keyboard use. Showing it on Tab but not on mouse click, which :focus-visible does, is allowed.
People who need to see focus
- Sighted keyboard users, including many people with motor disabilities, need the indicator the way mouse users need a pointer.
- Switch and voice users who move step by step through controls watch the indicator to track their position.
- People with low vision need a strong, high contrast indicator to find it at all.
- Anyone with attention or memory difficulties rely on it to resume a task after a break.
Screen reader users who are blind rely on speech rather than the indicator, but many screen reader users have some sight and use both.
Removing the ring versus restyling it
Fails: the outline is removed and nothing replaces it.
a:focus, button:focus {
outline: none;
}Passes: keyboard focus gets a thick, offset outline that stands out on light and dark backgrounds.
:focus-visible {
outline: 3px solid #1a4fa0;
outline-offset: 2px;
box-shadow: 0 0 0 5px #ffffff;
}The white shadow outside the blue outline keeps the indicator visible on dark areas too. If you change only the background color on focus, check the change is strong enough to notice; a slight shade shift is a common borderline case.
Focus visible wcag failures in real projects
| Failure | Where it shows up | Fix |
|---|---|---|
outline: none with no replacement | CSS resets, design system buttons | Add a :focus-visible style |
| Indicator same color as the background | Dark headers, brand colored footers | Use a two-tone indicator, such as outline plus shadow |
| Focus shown on a hidden inner element | Custom checkboxes and radio buttons | Style the visible part when the hidden input has focus |
Indicator clipped by overflow: hidden | Carousels, cards, scroll areas | Use outline-offset inside, or remove the clipping |
| Focus disappears inside an embedded widget | Third-party chat, video and map embeds | Choose components with visible focus or style them |
| Hover style used as the only focus style, and hover is subtle | Menus and links | Give focus its own clear style |
How to test wcag 2.4.7 in five minutes
Automated tools rarely catch this one, because they cannot see whether an outline is visible against a particular background. A person with a keyboard can check a template in minutes.
- Use the keyboard only. Load the page and press Tab from the very top, without touching the mouse.
- Find the indicator every time. At each stop, confirm you can see which element has focus within a second or two, without guessing.
- Cover every kind of control. Check links, buttons, fields, checkboxes, tabs, menu items, cards and controls inside dialogs and embedded widgets.
- Try different backgrounds. Pay attention where the background changes, such as dark headers, image banners and colored footers, since indicators often vanish there.
- Search the CSS. Look for outline none or outline 0 rules and confirm each one is paired with a visible replacement style.
- Check partly hidden focus. Note any focused item hidden behind a fixed banner, consent notice or floating help widget; that is a related 2.4.11 issue.
Zoom the browser to 200 percent while you test. A thin or pale indicator that seems fine at normal size often becomes clearly too weak.
Focus visible, focus not obscured and focus appearance
WCAG 2.2 added two related rules and kept 2.4.7 at AA, so a full focus review now has several parts.
| Rule | Level and version | What it checks |
|---|---|---|
| 2.4.7 | AA, WCAG 2.0 | A focus indicator is visible |
| 2.4.11 | AA, WCAG 2.2 | The focused item is not entirely hidden by author content such as sticky headers |
| 2.4.12 | AAA, WCAG 2.2 | No part of the focused item is hidden |
| 2.4.13 | AAA, WCAG 2.2 | The indicator covers at least the area of a 2 CSS pixel outline around the item, and those pixels contrast with their unfocused look by a 3:1 ratio at minimum |
| 1.4.11 | AA, WCAG 2.1 | Visual information needed to see states, including focus, has 3:1 contrast |
Read focus not obscured for the sticky header problem and non-text contrast for the 3:1 measurement. Focus order, the sequence of stops, is on its own page. The official text is in Understanding Focus Visible.
Questions people ask
What does 2.4.7 wcag require?
Every element you can operate with a keyboard must show a visible focus indicator when it receives keyboard focus. It sits at AA, and version 2.0 is where it began. The rule sets no size or contrast, but the indicator must be visible in practice.
Is outline none always a focus visible wcag failure?
Only when nothing else replaces it. Removing the default outline is fine if you add your own clear style, such as a thicker outline, a border or a strong background change.
Does the browser default focus ring pass?
For 2.4.7, usually yes, as long as nothing hides it. It can be hard to see on some colored backgrounds, so many teams set their own style to meet contrast expectations and 2.4.13.
Should I use :focus or :focus-visible?
Use :focus-visible for the main indicator. Browsers show it for keyboard focus and usually not for mouse clicks, which keeps designers happy and still meets the rule.
Is 2.4.7 the same as focus not obscured?
No. 2.4.7 asks that the indicator exists and is visible. 2.4.11, one of the 2.2 additions, wants the focused item to stay at least partly in view, not completely covered by things like sticky headers or cookie banners.