WCAG 2.4.11: Focus Not Obscured (Minimum)
WCAG 2.4.11 Focus Not Obscured (Minimum) is a Level AA success criterion introduced in WCAG 2.2. It mandates that when a user interface component receives keyboard focus, the focus indicator must not be completely hidden by other author-created content. This criterion is crucial for users who rely on keyboard navigation to interact with web content, ensuring they can always visually track their position on a page.
Why Focus Not Obscured Matters for Accessibility
The ability to clearly see which element has keyboard focus is fundamental for accessible web interaction. When a focus indicator is obscured, users can become disoriented, frustrated, and unable to complete tasks. This criterion directly addresses the needs of several user groups:
Without a visible focus, users cannot confidently navigate forms, click buttons, activate links, or interact with widgets, leading to an inaccessible and unusable experience.
Understanding the Success Criterion 2.4.11
The official wording for WCAG 2.4.11 is:
2.4.11 Focus Not Obscured (Minimum): When user interface components receive keyboard focus, the focus indicator is not entirely hidden by author-created content.
This is a Level AA success criterion. Key aspects to understand include:
This criterion complements WCAG 2.4.7 Focus Visible, which requires that any keyboard focus indicator be visible. WCAG 2.4.11 goes a step further by ensuring that even if a focus indicator exists, it isn’t rendered useless by being covered by other parts of the page’s design.
Practical Guidelines for Compliance
To ensure compliance with WCAG 2.4.11, developers and designers should consider the following:
Examples of Correct and Incorrect Implementations
Incorrect Implementation: Fixed Header Obscuring Focus
In this common scenario, a fixed header with a high z-index completely covers the focus indicator of elements located at the top of the viewport when they receive focus.
HTML
CSS
Problem
If a user navigates via keyboard (e.g., using Tab key) and an element like „Link 1” or „Link 2” receives focus near the top of the viewport, the .fixed-header will likely cover its focus outline entirely, making it impossible for the user to see where their focus currently is.
Correct Implementation: Using scroll-margin-top
To prevent the fixed header from obscuring focus, we can use scroll-margin-top on the focusable elements. This tells the browser to leave enough space at the top when scrolling to an an element’s fragment identifier or programmatically.
HTML
CSS
Explanation
By adding scroll-margin-top: 90px; to .focusable-item, we instruct the browser to always keep a 90-pixel buffer above these elements when they are scrolled into view (either by keyboard navigation or by direct links to their IDs), effectively preventing the 80px fixed header from obscuring their focus outline.
Correct Implementation: Using JavaScript for Dynamic Scrolling
For more complex scenarios, or when scroll-margin isn’t fully supported or sufficient, JavaScript can be used to manually adjust the scroll position when an element receives focus.
HTML
JavaScript
Explanation
This JavaScript snippet listens for the focusin event (which bubbles up). When an element receives focus, it checks if that element is currently obscured by the fixed header. If it is, it calculates the necessary scroll position to bring the element into view just below the header, adding a small offset for padding. This approach is more robust for dynamically sized headers or complex layouts, and it specifically excludes elements within the header itself from being scrolled.
Best Practices and Common Pitfalls
Best Practices
Common Pitfalls
Conclusion
WCAG 2.4.11 Focus Not Obscured (Minimum) is a critical criterion for creating accessible web experiences, particularly for keyboard users. By proactively managing the interaction between fixed/sticky elements and focus indicators, developers can ensure that all users have a clear and unambiguous way to interact with web content, leading to a more inclusive and usable internet.
Related posts
- WCAG 5.2.3: Complete processes
- WCAG 5.2.4: Only Accessibility-Supported Ways of Using Technologies
- WCAG 5.2.5: Non-Interference
- WCAG 5.3.1: Required elements of the conformity declaration
- WCAG 5.3.2: Optional Components of a Conformance Claim
Still looking for answers?
Ask our experts using online chat