WCAG 2.4.7 Focus Visible — Testing Guide for Mobile & Web Apps

WCAG 2.4.7: Ensuring Visual Focus Indicators for All Users

April 09, 2026 · 5 min read · WCAG Guides

WCAG 2.4.7: Ensuring Visual Focus Indicators for All Users

Understanding WCAG 2.4.7: Focus Visible

WCAG 2.4.7 requires that when an interactive element (like a button, link, or form field) receives keyboard focus, a visual indicator must clearly show which element is currently selected. This indicator should be distinct and easily noticeable. The goal is simple: users navigating with a keyboard or assistive technologies need to know precisely where they are on the screen at all times.

The Impact of Visible Focus

This criterion is crucial for users who rely on keyboard navigation or screen readers. Without a visible focus indicator, these users can become disoriented, unable to determine which element will be activated by their next keystroke.

Non-compliance with this standard can lead to significant usability barriers, potentially violating regulations like the EU's European Accessibility Act (EAA) and the Americans with Disabilities Act (ADA) in the United States.

Common Violations and Examples

Violations of WCAG 2.4.7 often stem from either removing default focus styles without providing replacements or implementing replacement styles that are too subtle.

Mobile App Violations:

  1. Default Focus Removal Without Replacement: Many frameworks allow developers to remove default focus outlines. If no custom style is applied, navigating via keyboard (e.g., using an external keyboard with Android/iOS) leaves the user blind to the focused element.
  1. Insufficiently Contrasting Focus Indicator: Applying a focus style that has poor contrast against the background or the element itself.

Web Application Violations:

  1. Subtle or Invisible Borders: Applying a focus style that is a thin, single-pixel border with very low contrast, or no border at all.
  1. Focus Style on Non-Interactive Elements: Applying focus styles to elements that are not intended to be interactive (e.g., divs that are styled to look like buttons but are not focusable by default).
  1. Overwritten Default Focus Styles: Custom CSS that overrides the browser's default :focus outline without providing a suitable alternative.

Testing for WCAG 2.4.7 Compliance

A multi-pronged approach combining manual testing, automated tools, and platform-specific considerations is most effective.

#### Manual Testing Steps

  1. Keyboard Navigation:
  1. Arrow Keys: For elements like radio button groups, checkboxes, or custom dropdowns, use the arrow keys to navigate within the group. Ensure the focus indicator moves correctly.
  2. Browser Developer Tools (Web):

#### Automated Tools

Several tools can assist in identifying potential violations:

#### Mobile-Specific Considerations (Android/iOS)

Fixing WCAG 2.4.7 Violations

The most robust solution involves using the :focus-visible pseudo-class. This allows you to define focus styles that appear only when a user is navigating via keyboard (or other non-pointer methods), preserving cleaner visual designs for mouse users.

Web Application Code Example (CSS):


/* Default styling for interactive elements */
.button {
  padding: 10px 20px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  cursor: pointer;
}

/* Styling for when an element receives focus via keyboard */
.button:focus-visible {
  outline: 2px solid #007bff; /* A clear, high-contrast outline */
  outline-offset: 2px;      /* Adds a small gap between outline and element */
  border-color: #007bff;     /* Optionally change border color too */
}

/* Fallback for older browsers or if you want focus for mouse users too */
.button:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Ensure focus styles are applied to focusable elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  /* Styles defined above or specific styles here */
}

/* For elements that are not natively focusable but need to be */
[tabindex]:focus-visible {
  /* Styles */
}

Mobile App Considerations:

How SUSA (SUSATest) Checks for Focus Visible

SUSA autonomously explores your application, mimicking various user personas, including those who navigate via keyboard.

By uploading your APK or web URL to SUSA, you can get immediate feedback on WCAG 2.4.7 compliance, alongside other critical issues like crashes, ANRs, and security vulnerabilities, all without writing a single line of test code.

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free