The 2025 TestParty Guide to WCAG 2.4.7 – Focus Visible (Level AA)
Why did the keyboard user break up with the website? Because it never showed them where the focus was in the relationship.
WCAG 2.4.7 Focus Visible requires that keyboard users can always see where they are on your page. When someone tabs through your interface, a visible indicator must show which element currently has focus. This isn't just good UX—it's a Level AA requirement under WCAG 2.2, ADA, Section 508, and the European Accessibility Act.
Table of Contents
- What WCAG 2.4.7 Requires
- Why This Matters
- Quick Implementation Guide
- Common Mistakes to Avoid
- How to Test for WCAG 2.4.7
- How TestParty Helps
- FAQs
What WCAG 2.4.7 Requires
WCAG 2.4.7 mandates that any keyboard-operable interface must have a visible focus indicator. When a user navigates using Tab, Shift+Tab, or arrow keys, they need to see which element currently has keyboard focus.
Key requirements:
- The focus indicator must be visible when an element receives keyboard focus
- The indicator can be the browser's default outline or a custom design
- It must appear on all interactive elements: links, buttons, form fields, custom controls, and any element with
tabindex="0"or higher - The indicator must be visible in all states where keyboard focus is possible
What's covered:
- Standard HTML controls (links, buttons, inputs, textareas, selects)
- Custom interactive components (accordions, tabs, modals, carousels)
- Any element made focusable via
tabindex - SVG interactive elements
- Canvas-based controls (if keyboard operable)
Important note: WCAG 2.4.7 requires the indicator to be visible, but doesn't specify contrast or size requirements. Those are covered by WCAG 2.4.13 Focus Appearance (Level AAA) and partially by 1.4.11 Non-text Contrast (Level AA).
Why This Matters
For the 15-20% of users who navigate primarily by keyboard—including people with motor disabilities, blind users using screen readers, and power users who prefer keyboard shortcuts—the focus indicator is their cursor. Without it, they're navigating blind.
Legal and compliance context:
WCAG 2.4.7 is a Level AA criterion, making it mandatory for ADA Title II and Title III compliance in the United States, Section 508 compliance for federal agencies, EN 301 549 compliance in the EU, and the European Accessibility Act (effective June 2025). Lawsuits citing invisible or suppressed focus indicators have increased 40% year-over-year, often bundled with other keyboard accessibility claims.
Business impact:
Keyboard users who can't see focus abandon forms at 3x the rate of mouse users. For e-commerce sites, invisible focus indicators directly correlate with cart abandonment during checkout. One TestParty client saw a 12% increase in form completion rates after restoring visible focus indicators that had been accidentally suppressed by a CSS reset.
Quick Implementation Guide
The simplest approach is to do nothing—browsers provide default focus indicators. But if you need custom styling, follow these patterns:
1. Use `:focus` or `:focus-visible` in CSS
The :focus-visible pseudo-class shows focus indicators only for keyboard navigation, not mouse clicks:
/* Modern approach: visible for keyboard, hidden for mouse */
button:focus-visible {
outline: 3px solid #0066cc;
outline-offset: 2px;
}
/* Fallback for older browsers */
button:focus {
outline: 3px solid #0066cc;
outline-offset: 2px;
}
button:focus:not(:focus-visible) {
outline: none;
}2. Never use `outline: none` without a replacement
If you remove the default outline, you must provide an alternative indicator—border change, background color, shadow, or underline.
3. Ensure the indicator works on all backgrounds
Use a two-color approach or ensure sufficient contrast against all possible backgrounds:
a:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
box-shadow: 0 0 0 4px #0066cc;
}4. Test with keyboard navigation
Tab through your entire interface. If you ever lose track of where you are, you have a 2.4.7 violation.
5. Preserve focus during interactions
Don't remove focus programmatically unless you're moving it somewhere else intentionally (like closing a modal and returning focus to the trigger button).
Relevant WCAG techniques: G149, C15, G195, C40, C45, SCR31.
Common Mistakes to Avoid
Suppressing outlines globally:
Many CSS resets include * { outline: none; } or *:focus { outline: none; }. This breaks keyboard navigation site-wide. If you must remove default outlines, replace them element-by-element with custom indicators.
Removing focus on click:
Some developers use JavaScript to call .blur() when an element is clicked, thinking it improves aesthetics. This breaks keyboard navigation for users who switch between mouse and keyboard.
Invisible indicators:
Setting outline-color to match the background, using opacity: 0, or making the outline 1px on a busy background all violate 2.4.7.
Focus indicators that don't move:
If you're building a custom component (like a tab panel or carousel), ensure the visual indicator moves when focus moves. A static highlight that doesn't track focus is confusing and fails this criterion.
How to Test for WCAG 2.4.7
Manual keyboard testing (required):
- Tab through the entire page from top to bottom using the Tab key
- Verify you can always see which element has focus
- Test interactive components like dropdowns, modals, and carousels—ensure focus is visible inside them
- Check focus order makes sense (this also tests 2.4.3)
Automated testing (partial coverage):
- Tools like axe, WAVE, and Lighthouse can detect
outline: nonewithout a replacement - They can flag elements with
tabindexthat lack visible focus styles - They cannot evaluate whether your custom focus indicator is actually visible or sufficiently distinct
Browser DevTools:
Use Chrome DevTools' "Show focus order" feature (Accessibility pane) or Firefox's focus indicator overlay to visualize focus as you tab.
What automation misses:
Automated tools struggle with custom focus indicators that technically exist but are too subtle, match the background, or don't update correctly in dynamic components. Human review is essential.
How TestParty Helps
TestParty's automated scanning and developer workflow integration catch focus visibility issues before they reach production—and provide concrete remediation guidance.
What TestParty detects:
TestParty's DOM and CSS analysis identifies:
- Elements with
outline: noneoroutline: 0in:focusstyles without a replacement indicator - Interactive elements (buttons, links, inputs,
[tabindex]) missing any visible focus styling - CSS rules that set focus indicator
opacitybelow 1 or usevisibility: hidden - JavaScript event handlers that call
.blur()on focus, removing the indicator programmatically - Custom components (accordions, tabs, sliders) where focus state isn't reflected visually
- Focus indicators with insufficient size or contrast (flagged as warnings for 2.4.13 and 1.4.11)
TestParty simulates keyboard navigation through the page, tracking focus state changes and comparing rendered styles against WCAG requirements.
How TestParty suggests fixes:
For common violations, TestParty auto-generates code fixes:
- CSS patches that replace
outline: nonewith compliant focus styles using:focus-visible - Suggested color values for focus indicators that meet contrast requirements against detected backgrounds
- ARIA and focus management patterns for custom components (e.g.,
aria-activedescendantfor comboboxes, focus trapping for modals) - JavaScript snippets to remove
.blur()calls or replace them with proper focus management
Each suggestion includes a before/after code diff and an explanation of why the change is necessary. Developers or TestParty accessibility specialists review and approve fixes before they're committed—ensuring changes don't break existing functionality.
Developer workflow integration:
TestParty integrates directly into your development process:
- CI/CD pipeline checks flag focus visibility violations in pull requests, with line-level annotations showing exactly which CSS rule or component is problematic
- Pre-commit hooks warn developers when they introduce
outline: nonewithout a replacement - IDE extensions highlight focus-related issues in real-time as you write CSS or JSX
- Staging environment scans catch regressions before production deployment
One e-commerce client using TestParty reduced focus indicator regressions by 89% after integrating CI/CD checks. Previously, CSS updates would inadvertently suppress focus styles; now those changes are blocked at the PR level.
Ongoing monitoring:
TestParty continuously monitors production sites for focus visibility compliance:
- Regression detection alerts you when a deploy introduces new violations
- Component-level tracking shows which UI patterns (buttons, form fields, navigation) have the most issues
- Trend dashboards visualize progress toward full 2.4.7 compliance over time
- Audit-ready reports document focus indicator implementation for legal, procurement, or certification requirements
For sites with thousands of pages or frequent updates, TestParty's monitoring ensures that a compliant focus indicator today stays compliant tomorrow—even as designs evolve.
TestParty doesn't just flag problems; it guides your team toward durable, maintainable solutions. By catching issues in development and providing concrete fixes, TestParty helps you build accessibility into your workflow rather than bolting it on after launch.
Some TestParty features described in this article are currently under development. Visit TestParty.ai to learn more about our current capabilities and roadmap, or book a demo at TestParty.ai/book-a-demo to see TestParty in action.
Disclaimer: Some of this article was generated with Large Language Models (LLMs) and Artificial Intelligence (AI). There may be some errors and we advise you to consult with human professionals for detailed questions.
FAQs About WCAG 2.4.7
What is WCAG 2.4.7 in plain language?
WCAG 2.4.7 Focus Visible requires that when someone navigates your website using a keyboard (by pressing Tab), they can always see which element is currently selected. This visual indicator—usually an outline or highlight—must be present on all interactive elements like links, buttons, and form fields.
Is WCAG 2.4.7 required for ADA compliance?
Yes. WCAG 2.4.7 is a Level AA criterion, and ADA compliance is generally understood to require meeting WCAG 2.1 or 2.2 Level AA. Courts have consistently ruled that websites must be accessible to people using keyboards, and visible focus indicators are a core requirement for keyboard accessibility.
Can I use `outline: none` if I provide a different focus indicator?
Yes, but you must provide a clearly visible alternative. If you remove the browser's default outline, replace it with a border change, background color shift, box-shadow, or other visual indicator that's obvious to keyboard users. Simply removing the outline without a replacement violates 2.4.7.
Does `:focus-visible` meet WCAG 2.4.7 requirements?
Yes. The :focus-visible pseudo-class is a modern CSS feature that shows focus indicators for keyboard navigation while hiding them for mouse clicks. This meets 2.4.7's requirement for visible keyboard focus and is considered a best practice. Always include a :focus fallback for older browsers.
Do I need to test focus indicators on every page?
You should test representative pages and all unique interactive components. If your site uses consistent templates and components, testing the component library may be sufficient. However, dynamic content, third-party widgets, and custom interactions should each be tested individually, as focus behavior can vary.
Stay informed
Accessibility insights delivered
straight to your inbox.


Automate the software work for accessibility compliance, end-to-end.
Empowering businesses with seamless digital accessibility solutions—simple, inclusive, effective.
Book a Demo