A visible outline or style that shows which element has keyboard focus. WCAG requires adequate contrast and size.
Focus indicators show which element currently has keyboard focus. They're essential for keyboard navigation, yet they're often the first thing designers remove because they "don't look good" with the design.
Here's the problem: removing focus indicators without providing alternatives makes your site completely unusable for keyboard users. It's like removing all the street signs in a city – people can still drive, but they have no idea where they're going.
WCAG 2.4.7 requires that focus be visible, and WCAG 2.2 strengthened these requirements with specific contrast and size minimums. This isn't optional accessibility – it's a fundamental usability requirement for millions of users.
Focus indicators aren't just for blind users – they serve a much broader audience:
Keyboard Users: - Motor disabilities that prevent mouse use - Power users who prefer keyboard efficiency - Temporary injuries (broken arm, RSI) - Situational limitations (no mouse available)
Cognitive Disabilities: - Visual tracking difficulties - Attention disorders that benefit from clear focus - Memory issues that require visual confirmation of location - Processing disorders that need extra visual cues
Visual Impairments: - Low vision users who can see but need high contrast - Users with visual processing disorders - Aging users with declining vision - Users in challenging lighting conditions
Technology Constraints: - Voice control users (Dragon, Voice Control) - Switch device users - Eye-tracking system users - Touch screen users with external keyboards
The Reality: Many users rely on keyboard navigation, including those with motor disabilities, power users who prefer keyboard shortcuts, and anyone temporarily unable to use a mouse. Remove focus indicators and you've made your site unusable for this significant population.
WCAG has specific, measurable requirements for focus indicators:
WCAG 2.4.7 Focus Visible (Level AA): - Any keyboard operable interface must have a visible focus indicator - The indicator must be visible when an element has focus - No specific contrast or size requirements (but must be visible)
WCAG 2.4.11 Focus Not Obscured (Minimum) (Level AA): - When an element receives focus, at least part of it must be visible - Sticky headers, cookie banners, and overlays can't completely hide focused elements - Users must be able to see what they've focused on
WCAG 2.4.13 Focus Appearance (Level AAA): - Focus indicator must be at least 2 CSS pixels thick - Must have 3:1 contrast ratio against both the focused element and adjacent colors - Must be at least as large as a 2 CSS pixel thick perimeter around the element - Provides specific, measurable standards for focus design
The Practical Standard: While 2.4.13 is Level AAA, many organizations adopt its requirements as best practice because they provide clear, testable criteria for good focus design.
Good focus indicators balance visibility with aesthetics:
High Contrast Approaches: ```css /* Strong outline approach */ button:focus { outline: 3px solid #0066cc; outline-offset: 2px; }
/* Box shadow approach (doesn't affect layout) */ button:focus { box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.5); }
/* Combined approach for maximum visibility */ button:focus { outline: 2px solid #ffffff; box-shadow: 0 0 0 4px #0066cc; } ```
Brand-Integrated Designs: ```css /* Use brand colors with sufficient contrast */ .primary-button:focus { box-shadow: 0 0 0 3px var(--brand-blue); background-color: var(--brand-blue-dark); }
/* Animated focus for attention */ .card:focus { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 3px var(--focus-color); transition: all 0.2s ease; } ```
Dark Mode Considerations: ```css /* Ensure focus works in both light and dark themes */ @media (prefers-color-scheme: dark) { button:focus { outline-color: #66b3ff; /* Lighter blue for dark backgrounds */ } } ```
The Design Principle: Focus indicators should be obvious but not jarring. They need to grab attention without overwhelming the interface. Think "clear and professional" not "neon and distracting."
These mistakes break keyboard accessibility constantly:
The Classic Mistake: ```css /* DON'T DO THIS */ * { outline: none; } button:focus { outline: none; } ``` This removes all focus indicators without providing alternatives. It's the #1 accessibility failure on the web.
Insufficient Contrast: ```css /* Too subtle - fails WCAG contrast requirements */ button:focus { outline: 1px solid #cccccc; /* Light gray on white */ } ```
Focus Traps and Overlays: - Modal dialogs that don't manage focus properly - Sticky headers that cover focused elements - Cookie banners that obscure navigation - Dropdown menus that hide focused items
Invisible Focus States: - Custom components without focus styles - SVG icons that can receive focus but show no indicator - Links styled to look like plain text - Form fields with invisible borders
Inconsistent Focus Behavior: - Some buttons show focus, others don't - Different focus styles across the same page - Focus indicators that disappear on hover - Custom components that don't match native focus behavior
Mobile Focus Issues: - Focus indicators that don't work with touch - External keyboard support missing on mobile - Focus management broken in mobile browsers - Touch and keyboard focus conflicts
Proper focus testing requires systematic keyboard navigation:
Manual Testing Process: 1. Tab Through Everything: Use only Tab, Shift+Tab, Enter, Space, and arrow keys 2. Check Visibility: Can you always see which element has focus? 3. Test Contrast: Do focus indicators meet 3:1 contrast requirements? 4. Verify Completeness: Can you reach every interactive element? 5. Test Functionality: Does Enter/Space activate focused elements?
Browser Testing: - Test in Chrome, Firefox, Safari, and Edge - Check both desktop and mobile browsers - Verify focus behavior with external keyboards on mobile - Test with browser zoom up to 200%
Screen Reader Testing: - Focus and screen reader cursor aren't always the same - Test with NVDA, JAWS, and VoiceOver - Verify focus announcements are clear and helpful - Check that focus moves logically through content
Automated Testing Tools: ```javascript // axe-core can detect some focus issues axe.run().then(results => { const focusIssues = results.violations.filter(v => v.id.includes('focus') || v.id.includes('keyboard') ); }); ```
Real User Testing: The best test is watching someone navigate your site with only a keyboard. Their struggles reveal problems automated tools miss.
Performance Testing: Ensure focus indicators don't cause layout shifts or performance issues, especially with animations or complex styling.
WebAbility provides comprehensive focus indicator management that balances accessibility with design aesthetics:
Automatic Enhancement: - Detects missing focus indicators across all interactive elements - Applies WCAG-compliant focus styles that match your design system - Ensures sufficient contrast in both light and dark modes - Provides fallback focus styles for custom components - Maintains focus visibility during dynamic content changes
Smart Design Integration: - Analyzes your existing design system and brand colors - Generates focus indicators that complement your visual identity - Provides multiple focus style options (outline, shadow, background) - Ensures consistency across all interactive elements - Adapts focus styles for different component types
Advanced Focus Management: - Implements proper focus trapping in modal dialogs - Manages focus order for dynamic content and SPAs - Prevents focus from being obscured by sticky elements - Handles focus restoration after modal closure - Optimizes focus flow for complex interactive widgets
Cross-Platform Compatibility: - Ensures focus indicators work across all browsers - Provides mobile keyboard support and external keyboard handling - Maintains focus visibility during touch and mouse interactions - Handles focus behavior in hybrid touch/keyboard environments - Optimizes performance for focus style animations
Developer Tools and Monitoring: - Real-time focus indicator validation during development - Integration with popular CSS frameworks and design systems - Automated testing for focus indicator regressions - Performance monitoring for focus style impact - Code examples and implementation guidance
Quality Assurance: - Keyboard navigation testing with actual users - Screen reader compatibility verification - Cross-browser and cross-device testing - Accessibility expert review of focus implementation - Ongoing monitoring for focus indicator effectiveness
WebAbility ensures your focus indicators meet WCAG requirements while maintaining your design integrity. Because accessible design isn't about compromise – it's about creating interfaces that work beautifully for everyone.
Join over 1 million websites using WebAbility to ensure digital accessibility compliance and provide equal access to all users.
A visible caret or pointer state that helps users track input focus or text insertion position, essential for low-vision and cognitive accessibility.
Single‑letter keyboard shortcuts that must be remappable, turned off, or only active on focus to prevent accidental activation.
Strategies to set and maintain focus order during dynamic changes such as modals, route transitions, and component mounts.
This glossary is continuously improved and maintained by WebAbility to advance accessible design and development.Contact us to suggest improvements or report issues.