Focus Visible: WCAG 2.4.7 and Visible Focus Styles
Also called: Visible focus, Focus indicator, Focus outline, Focus ring
Definition
Focus visible means that a website shows a visible indicator – usually an outline – on the link, button or field that currently has keyboard focus. WCAG 2.4.7 requires it at Level AA.
Focus visible means that people who use a keyboard can always see where they are on a page. When they press Tab, the active link, button or form field gets a clear focus indicator – typically an outline or ring around it. Without it, keyboard users are navigating blind: they press keys but cannot tell which element will react.
What it means
WCAG 2.4.7 Focus Visible is a Level AA criterion of WCAG 2.2. It says: "Any keyboard operable user interface has a mode of operation where the keyboard focus indicator is visible." The W3C adds that the indicator must not disappear after a few seconds. Through EN 301 549 (clause 9.2.4.7) it is part of what the European Accessibility Act expects.
The criterion matters for everyone who relies on keyboard navigation, and for people with attention, short-term memory or executive-function limitations who need to find their place again quickly.
2.4.7 does not prescribe how the focus indicator looks. Other criteria fill that gap:
| Criterion | Level | What it adds |
|---|---|---|
| 2.4.7 Focus Visible | AA | A visible focus indicator must exist |
| 1.4.11 Non-text Contrast | AA | The indicator needs at least 3:1 contrast against adjacent colors |
| 2.4.11 Focus Not Obscured (Minimum) | AA | The focused element must not be entirely hidden, e.g. by a sticky header |
| 2.4.13 Focus Appearance | AAA | Detailed rules for size and contrast of the indicator |
The browser's default focus indicator can be enough – the W3C accepts it as technique G165 – as long as it stays visible on your colors.
Examples
A good focus style uses a color with enough color contrast and some space around the element. The CSS pseudo-class :focus-visible shows the outline for keyboard users without showing it on every mouse click.
<style>
/* Fails 2.4.7: focus indicator removed */
a:focus, button:focus { outline: none; }
/* Passes: clear outline for keyboard focus, 5.98:1 on white */
a:focus-visible, button:focus-visible {
outline: 3px solid #005fcc;
outline-offset: 2px;
}
</style>A light gray outline like #cccccc on white reaches only 1.61:1. It is technically there, but most people will not see it, and it fails 1.4.11.
Style :focus-visible with a solid outline of 2–3px in a strong brand color, add outline-offset, and check the indicator on dark sections, images and buttons too.
Use outline: none without a replacement, show focus only through a subtle color shift, or let a sticky header cover the focused element.
How to check focus visible
Questions
What does focus visible mean in WCAG?
WCAG 2.4.7 Focus Visible (Level AA) requires that keyboard users can always see which element has focus. Usually an outline or ring around the active link, button or field shows it.
Is outline: none an accessibility violation?
Only if nothing replaces it. Removing the outline without another visible focus style fails WCAG 2.4.7 (W3C failure F78). Replacing it with your own clear style is fine.
How much contrast does a focus indicator need?
WCAG 2.4.7 sets no number, but focus indicators are visual components, so WCAG 1.4.11 asks for at least 3:1 against adjacent colors. The AAA criterion 2.4.13 Focus Appearance sets stricter rules.
What is the difference between :focus and :focus-visible?
:focus matches every focused element, including after a mouse click. :focus-visible lets the browser decide when a focus ring is helpful – typically during keyboard use. Styling :focus-visible keeps visible focus for keyboard users without rings on every click.
Can allyWay fix focus visible automatically?
Yes. allyWay adds clear focus outlines to links, buttons and fields where they are missing, as part of its automatic accessibility fixes. Because outlines are a visible change, they only go live after you approve them, and your code and theme stay untouched. Start for free and give keyboard users a clear path through your site.
Related terms
Keyboard Navigation: WCAG 2.1.1 Explained
Keyboard navigation means that every function of a website can be reached and operated with a keyboard alone – usually with Tab, Shift+Tab, Enter, Space and the arrow keys. WCAG 2.1.1 requires it at Level A.
Read definition: Keyboard Navigation: WCAG 2.1.1 ExplainedColor Contrast: WCAG Ratios and How to Check Them
Color contrast is the difference in brightness between text or interface elements and their background, measured as a ratio from 1:1 to 21:1. WCAG requires at least 4.5:1 for normal text and 3:1 for large text.
Read definition: Color Contrast: WCAG Ratios and How to Check ThemKeyboard Trap: WCAG 2.1.2 Explained and Fixed
A keyboard trap is a part of a page that keyboard focus can enter but not leave using the keyboard alone. WCAG 2.1.2 No Keyboard Trap forbids it at Level A.
Read definition: Keyboard Trap: WCAG 2.1.2 Explained and FixedSkip Link: Jump Straight to the Main Content
A skip link is a link at the very top of a page that jumps to the main content, so keyboard and screen reader users do not have to pass the whole menu on every page. It is a sufficient technique for WCAG 2.4.1.
Read definition: Skip Link: Jump Straight to the Main Content