Skip to the checklist
The Focus RingWCAG · screen readers · assistive tech

Checklist › Visual

Focus Visible: The Outline You Keep Deleting

Filed 2026-10-23

1 Why this criterion exists

When you navigate a website using only a keyboard, you need to know where you are at all times. The focus indicator—often a dotted or solid outline—is the visual cue that tells you which link, button, or form field will activate when you press Enter or Space. Without it, keyboard navigation becomes a guessing game. WCAG Success Criterion 2.4.7 Focus Visible exists to guarantee that this essential feedback is never removed. It falls under the Operable principle, which ensures that interface components and navigation are operable by all users, regardless of input method.

The criterion is straightforward: any keyboard-operable user interface must have a mode of operation where the keyboard focus indicator is visible. This is a Level AA requirement, meaning it is expected for most websites and applications. The intent is not to dictate a specific visual style but to ensure that some visible indication of focus is present. Designers and developers sometimes remove outlines because they find them aesthetically unpleasing, but doing so without a replacement breaks the experience for keyboard users. The focus indicator is not decorative; it is a functional requirement for accessibility.

Historically, browsers provided default focus outlines, but CSS resets and custom designs often stripped them away. This criterion pushes teams to consciously design focus states that are both visible and consistent with the brand. It also acknowledges that focus must be perceivable in all contexts, including high-contrast modes and on various backgrounds. By meeting this criterion, you ensure that keyboard navigation remains efficient and predictable, which benefits not only users with disabilities but also power users who prefer the keyboard.

2 Who it protects

The primary beneficiaries of a visible focus indicator are people who cannot use a mouse. This includes individuals with motor impairments such as tremors, limited dexterity, or paralysis, who rely on keyboards, switch devices, or other alternative input methods. For these users, the focus indicator is the equivalent of a mouse cursor—it shows them exactly where their input will take effect. Without it, they may activate the wrong control, become disoriented, or abandon the task entirely.

Screen reader users also benefit, though in a different way. Many screen reader users navigate by keyboard and may have some vision. For them, the focus indicator provides a visual confirmation that matches the auditory feedback from the screen reader. This redundancy helps users with partial sight or cognitive disabilities maintain context. Additionally, users with low vision often magnify the screen and rely on strong visual cues; a faint or missing focus outline can be impossible to see. People with cognitive disabilities may find it easier to track their position when the focus is clearly marked, reducing cognitive load.

Beyond disability, visible focus helps anyone who temporarily cannot use a mouse, such as someone with a broken arm or a user in a situation where a mouse is unavailable. It also aids users who prefer keyboard navigation for speed and efficiency. By designing for focus visibility, you create a more robust interface that accommodates a wide range of abilities and preferences. This criterion is a cornerstone of inclusive design because it addresses a fundamental interaction need: knowing where you are and what will happen next.

3 How conformance is measured

Conformance to WCAG 2.4.7 is evaluated by checking whether every keyboard-focusable element displays a visible focus indicator when it receives focus. The criterion does not prescribe a specific appearance, but the indicator must be visible and distinguishable from the unfocused state. Testers typically use a keyboard to tab through all interactive elements—links, buttons, form fields, custom widgets—and observe whether a focus outline, highlight, or other visual change occurs. If any element lacks a visible indicator, the page fails the criterion.

Automated tools can help identify elements that have outline: none or outline: 0 without a replacement, but they cannot fully determine visibility. For example, a focus style might be present but have insufficient contrast against the background, or it might be clipped by overflow. Therefore, manual testing is essential. Testers should also check focus visibility in different states, such as when the element is partially obscured or when the page is zoomed. The criterion applies to all keyboard-operable user interface components, including those in rich internet applications.

It's important to note that the focus indicator must be visible in the default state; it cannot rely on hover or other non-keyboard interactions. Additionally, the indicator should not be so subtle that it is easily missed. While WCAG 2.4.7 does not specify a minimum contrast ratio, related criteria like 1.4.11 Non-text Contrast (Level AA) require that focus indicators have a contrast ratio of at least 3:1 against adjacent colors. Meeting 2.4.7 is the first step; ensuring the indicator is also perceivable for low vision users often involves meeting 1.4.11 as well. Together, these criteria ensure that focus is not only present but also clearly visible.

4 Where teams usually slip

The most common mistake is removing the focus outline entirely. Developers often add a global CSS reset like outline: none or outline: 0 to all elements, either to eliminate what they consider an ugly default or to prevent double outlines in custom designs. This single line of CSS can break keyboard accessibility across an entire site. Even if a custom focus style is added later, it may not apply to all elements, leaving some without any indicator. Another frequent slip is applying focus styles only to certain components, such as links but not buttons, or vice versa. Inconsistent focus treatment confuses users and fails the criterion.

A subtler issue is using :focus without considering :focus-visible. The :focus pseudo-class applies whenever an element receives focus, including when clicked with a mouse. This can lead to focus rings appearing on mouse clicks, which some designers find undesirable. In response, they may remove focus styles altogether. The :focus-visible pseudo-class solves this by only showing focus when the user agent determines it should be visible, typically for keyboard navigation. However, if :focus-visible is used without a fallback for older browsers, some users may see no focus indicator at all. Teams also slip when they rely on color alone to indicate focus, such as changing the background color slightly. This can be insufficient for users with color vision deficiencies or low vision.

Another common pitfall is designing focus styles that are obscured by other elements. For example, a sticky header might cover the focused element when tabbing, or a modal dialog might not trap focus properly. Even if a focus indicator exists, it must be visible on screen. Finally, teams sometimes forget to test focus visibility in high-contrast mode or with custom user stylesheets. In these modes, background images and colors may be overridden, and a focus indicator that relies on a background image could disappear. Thorough testing across modes and browsers is necessary to catch these issues.

5 Fixing it in your markup

The first step to fixing focus visibility is to stop removing outlines indiscriminately. Instead of a global outline: none, target only elements where you will provide an alternative. For most projects, the best practice is to use the :focus-visible pseudo-class to style focus indicators. This allows you to show a clear outline for keyboard users while suppressing it for mouse clicks. A typical implementation sets a custom outline using properties like outline: 2px solid #005fcc; outline-offset: 2px;. The outline-offset property creates a small gap between the element and the outline, improving visibility. You can also use box-shadow to create a focus ring, but be aware that box-shadow may not be visible in forced colors mode.

Ensure that your focus styles have sufficient contrast. WCAG 1.4.11 requires a 3:1 contrast ratio for non-text content, including focus indicators. Test your chosen colors against the background. If you use a custom focus ring, consider adding a dark and light version to work on both light and dark backgrounds. For elements that are not natively focusable, such as custom div-based buttons, you must add tabindex="0" and a role, and then style the :focus state. Remember that focus must also be visible when the element is focused programmatically, such as after a form submission or when a modal opens.

When using CSS frameworks or resets, check their default focus handling. Many modern resets preserve focus outlines or provide accessible defaults, but some older ones do not. You can override with your own focus styles. Also, consider using the :focus-within pseudo-class on containers to highlight a group of elements, such as a form field with an input and a button. This can be helpful for complex widgets. Finally, test your focus styles with keyboard navigation to ensure they are not clipped by overflow: hidden or covered by other elements. Adjust z-index or positioning as needed. By thoughtfully implementing focus styles, you meet the criterion and improve the overall usability of your site.

6 Testing before you ship

Testing for focus visibility should be a standard part of your quality assurance process. Start by manually tabbing through every page and interactive element. Use the Tab key to move forward and Shift+Tab to move backward. Observe whether a focus indicator appears on each element. Check that the indicator is clearly visible and not obscured by other content. Test in multiple browsers, as default focus styles and :focus-visible support can vary. Also test with a keyboard only, without touching the mouse, to simulate the experience of a keyboard-only user. This simple manual test will catch most issues.

Automated accessibility tools can flag missing focus styles, but they are not foolproof. Tools like axe, Lighthouse, or WAVE can detect outline: none or outline: 0 without a replacement, but they cannot assess visual visibility. Use them as a first pass, then follow up with manual checks. For more thorough testing, use browser developer tools to inspect the computed styles of focused elements. You can also use the Accessibility Insights for Web extension, which includes a focus visible check. Additionally, test with high-contrast mode enabled in Windows or with a forced colors mode in your browser. In these modes, custom focus styles may be overridden, so ensure that a visible indicator still appears.

Consider testing with actual users who rely on keyboard navigation. While this may not be feasible for every project, it provides invaluable insights. If you cannot test with users, simulate common scenarios: navigate a form, open a modal, use a dropdown menu. Ensure focus moves logically and remains visible. Pay attention to focus order and focus trapping in dialogs. Remember that focus visibility is not just about meeting a checkbox; it's about ensuring a smooth experience. Document your testing steps and include focus visibility in your definition of done. By making it a routine part of your process, you prevent regressions and ensure ongoing conformance.

7 Frequently asked questions

Is it okay to remove the focus outline if I replace it with a custom style? Yes, as long as the custom style is visible and meets contrast requirements. The criterion does not mandate the default browser outline; it requires a visible focus indicator. However, you must ensure the custom style applies to all focusable elements and is not removed by other CSS. Using :focus-visible is a good way to provide a custom style without affecting mouse users.

What is the difference between :focus and :focus-visible? The :focus pseudo-class applies whenever an element receives focus, whether by keyboard or mouse. The :focus-visible pseudo-class applies only when the browser determines that focus should be visibly indicated, typically for keyboard navigation. Using :focus-visible allows you to show focus rings for keyboard users while hiding them for mouse clicks. However, not all browsers support :focus-visible, so you may need a fallback using :focus for older browsers.

Does WCAG 2.4.7 require a specific color or thickness for the focus indicator? No, the criterion only requires that the focus indicator is visible. However, related criteria like 1.4.11 Non-text Contrast require a 3:1 contrast ratio against adjacent colors. It's best practice to use a thick, high-contrast outline that is easy to see. Also, ensure the indicator is not obscured by other elements.

What about focus visibility on custom widgets like sliders or date pickers? Custom widgets must also have visible focus indicators. If you build a custom widget, ensure that each focusable part (e.g., the slider handle) shows a visible focus state. Use ARIA roles and properties to convey state, but visual focus is still required. Test with keyboard navigation to confirm.

Can I use outline: none on non-interactive elements? Yes, but be cautious. Non-interactive elements are not focusable by default, so removing outline on them has no effect. However, if you add tabindex to make them focusable, you must provide a visible focus indicator. It's generally better to avoid making non-interactive elements focusable unless necessary.

How does focus visibility relate to screen readers? Screen readers provide auditory feedback about the focused element, but visual focus is still important for users with partial sight or cognitive disabilities. Some screen reader users also use magnification, so a visible focus indicator helps them track their position. Therefore, focus visibility benefits all users, not just those who are fully sighted.