WCAG 2.2 - Success Criterion
2.4.7 Focus Visible
Description
Any keyboard-operable user interface must have a mode of operation where the keyboard focus indicator is visible. When a user moves focus to an interactive element by pressing Tab or another keyboard key, there must be a visible visual change - typically a border, outline, highlight, or background color change - indicating which element currently has focus. Without a visible focus indicator, keyboard users cannot tell where they are on the page.
How To Test
- Navigate to the page using only the keyboard (Tab and Shift+Tab).
- As you Tab through each element, observe whether a visible focus indicator appears on the currently focused element.
- Check whether the focus indicator disappears on any element - this is a failure if
outline: noneis applied without a replacement. - Inspect the CSS for
outline: none,outline: 0, orbox-shadowreplacements on:focusor:focus-visiblestates. - If a custom focus style is provided, assess whether it is visually distinct and perceivable against the background and surrounding content.
- Test all interactive elements: links, buttons, inputs, selects, checkboxes, radio buttons, and custom widgets.
Testing Tools
- axe DevTools — Browser extension. Install from official page, open DevTools, go to axe tab, run scan. Look for focus order, keyboard trap, and focus visible violations.
- NVDA — Free screen reader for Windows. Download and install, then open Firefox and navigate the demo using Tab, Shift+Tab, arrow keys, and Enter. Listen for focus announcements.
- Browser DevTools Accessibility Inspector — Built into all browsers. Right-click on a focused element, select "Inspect", open DevTools, go to Accessibility tab to see the accessibility tree and focus properties.
Demo 1: Focus visible demo
Press Tab to move through the links below. No focus indicator appears - keyboard users cannot tell which link is active.
CSS applied: outline: none
Press Tab to move through the links below. A clear focus ring appears on the active link.
No override - the site's :focus-visible style applies.
Code
Demo 2: High Contrast Mode Compatibility
These buttons use only box-shadow for focus styling. In Windows High Contrast Mode, box-shadow is ignored, so the focus indicator disappears entirely.
CSS applied: outline: none; box-shadow: 0 0 0 3px #0056b3 — invisible in High Contrast Mode
These buttons use the outline property for focus styling. Outline is preserved in Windows High Contrast Mode, ensuring focus remains visible for all users.
CSS applied: outline: 3px solid #0056b3; outline-offset: 2px — visible in all modes
Code
These links have outline:none applied. Tab through them — you can activate them but cannot see which one has focus. Found in 15 real-world audits.
Try Tab — links receive focus but show no indicator at all.
Links use :focus-visible — shows focus ring on keyboard navigation but not on mouse click.
Tab shows a clear focus ring. Click does not — best of both worlds with :focus-visible.
Code
Fail Explanation
A failure occurs most commonly when CSS contains outline: none or outline: 0 applied to focused elements globally (e.g., *:focus { outline: none; }), removing the browser's default focus ring without providing a custom replacement. This leaves keyboard users with no visual indicator of their position on the page, making the entire interface unusable. Low-contrast or very thin custom focus styles that are not perceivable also constitute a failure, though this is more precisely addressed in WCAG 2.2's new 2.4.13 (Focus Appearance).
Pass Explanation
A passing implementation ensures that every focusable element displays a clearly visible focus indicator when focused. The browser's default focus ring is acceptable, but custom focus styles must be visible enough to be noticed. Common passing approaches include a high-contrast outline (e.g., a 2px solid outline in a color with at least 3:1 contrast against adjacent colors), a background color change, or an underline. The focus style must be present on all interactive elements including links, buttons, form inputs, and custom widgets.
Notes
WCAG 2.2 introduced the new criterion 2.4.11 (Focus Not Obscured) and 2.4.13 (Focus Appearance) to address additional aspects of focus visibility. Note that 2.4.7 is a relatively low bar - it only requires that focus be visible in some mode, not that the focus indicator meet specific size or contrast requirements. The :focus-visible CSS pseudo-class allows developers to show focus indicators for keyboard navigation only, without showing them on mouse click, which is an acceptable and widely used approach.
Techniques
WCAG techniques used in this demo: C15, C40, G195
Suggested Solutions & References
Curated from 24 real-world audit findings and official WCAG guidance.
Official W3C / WAI
- Understanding SC 2.4.7: Focus Visible
- Technique G195: Author-supplied visible focus indicator
- Technique C40: Two-color focus indicator