Focus Indicator
A focus indicator is a visible outline or highlight that shows which interactive element on a web page currently has keyboard focus, enabling users who navigate without a mouse to track their position.
In simple terms: A focus indicator is like a bright outline that shows you which button or link you're on when you press the Tab key on your keyboard. It's like a cursor for people who don't use a mouse—without it, they'd have no idea where they are on the page.
What Is Focus Indicator?
A focus indicator is a visual cue that identifies which interactive element on a web page currently has keyboard focus. When a user navigates a website using the Tab key (or other keyboard shortcuts), the focus indicator moves from one interactive element to the next—links, buttons, form fields, and other controls—providing a visual confirmation of the user's current position on the page. The most common default focus indicator is a blue or dotted outline that browsers automatically apply to focused elements. However, these defaults vary between browsers and operating systems. Chrome displays a blue glow, Firefox shows a dotted outline, and Safari uses a blue ring. Developers can customize these indicators using CSS to create more prominent, branded focus styles. Focus indicators are fundamental to keyboard accessibility. Without them, a keyboard user has no way of knowing which element they are interacting with. It is the equivalent of removing the mouse cursor for a mouse user—navigation becomes essentially impossible. Every interactive element that can receive keyboard focus should have a visible focus indicator. This includes links, buttons, form inputs, checkboxes, radio buttons, dropdown menus, tab panels, and any custom interactive components built with JavaScript and ARIA.
Why It Matters
Focus indicators matter because they are the primary navigation tool for anyone who cannot or chooses not to use a mouse. This includes people with motor disabilities who use keyboard navigation, people who use switch devices, people with visual impairments who use screen magnifiers in conjunction with keyboard navigation, and power users who prefer keyboard shortcuts for efficiency. According to accessibility research, keyboard navigation is one of the most common accessibility requirements. People with conditions like tremors, paralysis, repetitive strain injuries, or limb differences often rely entirely on keyboard or keyboard-like devices. For these users, a missing focus indicator renders a website essentially unusable. Focus indicators also benefit users with low vision who may use screen magnification software. When the screen is magnified, only a portion of the page is visible at any time. A clear focus indicator helps these users locate where they are on the page within the magnified view. The removal of focus indicators is one of the most common accessibility violations on the web. The CSS declaration `outline: none` or `outline: 0`, applied globally without a replacement focus style, has been called one of the most harmful single lines of CSS for accessibility. Many designers remove the default outline because they consider it unattractive, not realizing they are eliminating a critical accessibility feature. WCAG addresses focus indicators in multiple success criteria. WCAG 2.0 SC 2.4.7 (Level AA) requires visible focus indicators. WCAG 2.2 strengthened this with SC 2.4.11 (Focus Not Obscured - Minimum, Level AA) and SC 2.4.13 (Focus Appearance, Level AAA), which specify minimum size and contrast requirements for focus indicators.
How It Works
### Default Browser Focus Browsers provide built-in focus indicators through the `:focus` CSS pseudo-class. When an element receives focus, the browser applies a default outline style. While functional, these defaults are often minimal and can be difficult to see against certain backgrounds. ### Custom Focus Styles Developers can create custom focus indicators using CSS. Effective custom focus styles typically involve: ```css /* Basic custom focus indicator */ :focus { outline: 3px solid #0056b3; outline-offset: 2px; } /* Focus-visible for keyboard-only indication */ :focus-visible { outline: 3px solid #0056b3; outline-offset: 2px; } /* Remove outline for mouse users only */ :focus:not(:focus-visible) { outline: none; } ``` ### The :focus-visible Approach The CSS pseudo-class `:focus-visible` is a modern solution that displays focus indicators only when the browser determines the user is navigating via keyboard. Mouse clicks do not trigger `:focus-visible` on most elements, allowing designers to maintain clean visual designs while preserving keyboard accessibility. This approach resolves the longstanding tension between designers who want to remove outlines and accessibility advocates who insist they remain visible. With `:focus-visible`, both goals are achieved. ### Focus Indicator Design Best Practices Effective focus indicators should: - **Be highly visible**: Use a minimum 3px outline with a color that contrasts against the background. - **Not rely on color alone**: Combine outline styles with other visual changes like a background color shift or box shadow. - **Be consistent**: Use the same focus style throughout the website so users develop predictable expectations. - **Not be obscured**: Ensure the focus indicator is not hidden behind sticky headers, overlays, or other positioned elements (per WCAG 2.4.11). - **Have sufficient contrast**: The focus indicator should have a 3:1 contrast ratio against adjacent colors. ### Focus Management in Dynamic Content For single-page applications and dynamic content, focus management becomes more complex. When content changes—such as opening a modal dialog, loading new content, or navigating to a new view—developers must programmatically manage focus to ensure the focus indicator appears in a logical position. This prevents the user from losing their place in the interface.
Examples
**Example 1: Default vs. Custom Focus** A website uses the browser's default focus outline on all interactive elements. While technically compliant with WCAG 2.4.7, the thin dotted outline is nearly invisible against the site's light gray background. The development team implements a custom focus indicator: a 3px solid blue outline with a 2px offset and a subtle box shadow, making focus clearly visible against all background colors on the site. **Example 2: Focus-Visible Implementation** A corporate website implements `:focus-visible` to show focus indicators only during keyboard navigation. When a user clicks a button with a mouse, no outline appears. When a user tabs to the same button, a prominent blue ring appears. This satisfies both the design team's aesthetic requirements and the accessibility team's functional requirements. **Example 3: Modal Focus Management** An e-commerce site opens a modal dialog when users click "Add to Cart." The developer ensures that when the modal opens, focus is programmatically moved to the modal's close button with a visible focus indicator. When the modal is dismissed, focus returns to the "Add to Cart" button that triggered it. Without this focus management, keyboard users would lose their position on the page. **Example 4: High Contrast Focus for Dark Themes** A website offers a dark theme with a near-black background. The default blue focus outline is barely visible. The developer creates theme-specific focus styles: for the light theme, a dark blue outline; for the dark theme, a bright yellow outline with a white inner ring. Both achieve sufficient contrast against their respective backgrounds.
Frequently Asked Questions
- Why do some websites remove focus indicators?
- Some designers remove focus indicators because they consider the default browser outline visually unappealing. This is a significant accessibility mistake. Instead of removing focus indicators entirely, designers should create custom focus styles that match their design system while remaining clearly visible.
- What does WCAG say about focus indicators?
- WCAG 2.0 Success Criterion 2.4.7 (Level AA) requires that any keyboard-operable interface has a mode of operation where the keyboard focus indicator is visible. WCAG 2.2 added Success Criterion 2.4.11 (Level AA) requiring a minimum focus appearance with specific size and contrast requirements.
- Should focus indicators be visible for mouse users too?
- Modern best practice is to show focus indicators for keyboard users but optionally hide them for mouse users. The CSS pseudo-class :focus-visible allows developers to display focus styles only when the user is navigating via keyboard, which addresses both accessibility and design concerns.
Need help making your website ADA compliant?
Our team specializes in ADA-compliant web design and remediation. Get a free accessibility audit today.
Last updated: 2026-03-15