
Why Sticky Headers Hide Your Keyboard Focus (WCAG 2.4.11)
Sticky headers, cookie banners and chat widgets can hide a focused element completely — here's how WCAG 2.4.11 and 2.4.13 define the problem and the fix.
WCAG 2.4.11 Focus Not Obscured (Minimum) requires that when a keyboard user tabs to a link, button, or form field, that element can't be completely hidden behind other content you've placed on the page — things like a sticky header, a cookie banner, or a chat widget. It's a Level AA criterion in WCAG 2.2, and it's failing on a lot of sites that otherwise look accessible, because the focus indicator itself works fine — it's just sitting underneath something else.
This is a different problem than the one covered in most "my outline disappeared" articles. If your CSS includes outline: none with no replacement, that's a 2.4.7 problem — the indicator doesn't exist at all. Focus Not Obscured is about indicators that exist and look fine, but get covered up by a fixed-position element the moment the browser scrolls that section into view. Related to it is 2.4.13 Focus Appearance, which defines how big and how visible a focus indicator has to be once it is visible. Both matter, and both get missed by teams who think they already "did focus" when they fixed the outline color.
What does WCAG 2.4.11 Focus Not Obscured actually require?
WCAG 2.4.11 says that when a component receives keyboard focus, it must not be entirely hidden by author-created content, such as sticky headers, footers, or persistent overlays. The key word is "entirely." At the AA level, partial obscuring is allowed — if a sticky header covers the top third of a focused button but you can still see enough of it to know focus is there, you technically pass 2.4.11.
There's a stricter version, 2.4.12 Focus Not Obscured (Enhanced), at Level AAA, which requires that no part of the focused component be hidden. Most organizations targeting WCAG 2.1 AA or 2.2 AA only need to satisfy the minimum version, but if you're building for AAA or for a government client with a stricter internal policy, treat any obscuring as a failure, not just full coverage.
You can read the exact wording for both in the WCAG 2.2 quick reference.
How do sticky headers hide the focused element?
The mechanism is almost always the same: a fixed or sticky-positioned header sits at position: fixed or position: sticky with a high z-index, and the browser's native "scroll focused element into view" behavior doesn't know the header exists. When a user tabs to a link near the top of the page, the browser scrolls just enough to bring that link to the edge of the viewport — which, on a page with a 90px sticky header, means the link lands behind the header, not below it.
This happens constantly with in-page anchor navigation, skip links, and any long-form content with a table of contents. It also tends to get worse over time, because the header height creeps up as marketing adds an announcement bar or secondary nav row, and nobody re-tests keyboard focus after the layout changes.
The fix is a CSS property most teams already know for anchor links but forget applies to focus too:
html {
scroll-padding-top: 96px; /* match your sticky header's real height */
}
If you need it on specific elements instead of the whole document, use scroll-margin-top on the focusable elements themselves:
.anchor-target, a, button, input, select, textarea {
scroll-margin-top: 96px;
}
Both properties are supported in all current browsers — see MDN's scroll-padding-top reference. Set the value dynamically with a CSS variable if your header height changes between mobile and desktop, so you're not hardcoding a number that breaks at a different breakpoint.
How do cookie banners and chat widgets break focus visibility?
Cookie consent banners and chat widgets cause a slightly different version of the same bug. They're usually fixed to the bottom of the viewport, sitting on top of footer links, form submit buttons, or the last few items in a navigation menu. A keyboard user tabbing through the page hits a button that's visually underneath the banner — focus is technically on the element, but there's nothing to see.
Some consent tools make this worse by also trapping focus incorrectly: the banner itself isn't the first or last focusable thing in the DOM, so tabbing past it doesn't just obscure a button, it skips over real content entirely. That's a separate, related failure under 2.1.2 (No Keyboard Trap), and it's common enough that it's worth checking specifically. If you haven't already audited your consent banner for this, the cookie banner focus trap guide walks through how to test and fix it.
Chat widgets have the same problem in reverse: they often inject themselves at the end of the DOM with a high z-index, so they cover whatever happens to be positioned at the bottom-right of the page when a user is tabbing through late-page content. If your chat widget vendor doesn't expose a way to adjust its stacking or dismiss it via keyboard, that's worth raising with the vendor directly — it's their bug, not just yours.
Modals and popups introduce their own version of this pattern too, especially when a dialog opens on top of content that still has visible, reachable focus underneath it. If that applies to your site, the modal and focus trap fix guide covers the dialog-specific version of the same underlying problem.
What does a compliant focus indicator need to look like? (WCAG 2.4.13)
WCAG 2.4.13 Focus Appearance is a Level AAA criterion, but it's the clearest technical definition we have of what a "good enough" focus indicator looks like, and it's worth designing to even if you're only required to hit AA. It sets concrete, testable minimums:
- The focus indicator must cover an area at least as large as a 2 CSS pixel thick perimeter outline around the unfocused component.
- It must have a contrast ratio of at least 3:1 between the pixels in the focused and unfocused states.
- Where the indicator is partially obscured by other author-created content, it still has to meet the above minimums for whatever part remains visible.
These numbers come straight from the WCAG 2.2 specification, not from an estimate — they're the actual test you (or an automated checker) can apply. A 1px dotted outline in a color close to the background fails this even if it's technically present, because it doesn't clear the 2px/3:1 bar.
In practice, this means your :focus-visible styles need more than just "not removed." A solid, 2-3px outline with real color contrast against both the element and its background handles most of this:
:focus-visible {
outline: 3px solid #1a56db;
outline-offset: 2px;
}
If your design system relies on a subtle box-shadow instead of an outline, measure it against the 3:1 ratio requirement the same way you'd check text contrast — a shadow that's barely visible against a white card isn't a focus indicator, it's a decoration. If you've already got outline removal issues to deal with first, the focus indicator fix guide covers that baseline problem before you get into appearance details.
How do you test for obscured focus in practice?
Manual keyboard testing is the only reliable way to catch this, because automated scanners can tell you an outline exists in the CSS without knowing whether a sticky element is rendering on top of it at a given scroll position. Here's a practical pass:
- Load the page and press Tab repeatedly, watching where the focus indicator lands relative to any fixed header, banner, or widget.
- Pay special attention to the first few tab stops after a skip link, and to any in-page anchor jump — these are where header-covering bugs show up first.
- Scroll to the bottom of a long page and tab through footer links and form submit buttons with a cookie banner or chat widget open.
- Resize the browser to a common mobile width and repeat the test — sticky headers often get taller on mobile, which changes how much gets covered.
Running your pages through a scanner first still saves time, even though this specific check needs a human pass to confirm. AccessKnight's free scanner checks 33 automated WCAG 2.1 rules and flags structural issues — missing focus styles, skipped heading levels, unlabeled controls — that often sit next to this kind of layering bug, so you know where to focus your manual tab-through before you start.
Key Takeaways
- WCAG 2.4.11 (Level AA) fails when a sticky header, banner, or widget completely hides a keyboard-focused element — partial obscuring is allowed at this level.
- WCAG 2.4.12 (Level AAA) is the stricter version: no part of the focused element can be hidden.
- WCAG 2.4.13 (Level AAA) defines what a compliant focus indicator actually looks like: at least a 2 CSS pixel perimeter and a 3:1 contrast ratio between focused and unfocused states.
scroll-padding-topandscroll-margin-topfix the most common sticky-header case without touching your layout.- Cookie banners and chat widgets need their own keyboard pass — stacking order and dismissibility matter as much as the focus style itself.
- This needs manual keyboard testing. Automated scanners can confirm an outline exists in code; they can't always confirm it's visible at a given scroll position.
Frequently Asked Questions
Is WCAG 2.4.11 Focus Not Obscured required for AA compliance?
Yes. WCAG 2.4.11 Focus Not Obscured (Minimum) is a Level AA success criterion in WCAG 2.2, which means it's in scope for any organization targeting WCAG 2.1 AA plus the new WCAG 2.2 criteria, including state and local governments working toward ADA Title II deadlines. Its stricter sibling, 2.4.12 (Enhanced), is Level AAA and not required for most compliance targets.
What's the difference between 2.4.11 and 2.4.13?
2.4.11 Focus Not Obscured is about visibility — whether something else on the page is covering the focused element. 2.4.13 Focus Appearance is about design — whether the focus indicator itself is big enough and high-contrast enough to be seen once nothing is covering it. A page can pass one and fail the other: a focus outline can be perfectly visible and still fail 2.4.13 if it's too thin or low-contrast, or it can meet every size and contrast requirement and still fail 2.4.11 if a cookie banner sits on top of it.
Does a sticky header automatically fail WCAG 2.4.11?
No. A sticky header only fails 2.4.11 if it completely hides a focused element with no part visible. If part of the focus indicator remains visible when a header overlaps it, the page can still pass at the AA level. Most real-world failures happen because the header covers the entire focused element, not just a sliver of it — which is exactly what happens when browser auto-scroll doesn't account for fixed header height.
Does removing outline:none fix this problem?
No, and that's the main thing to understand about this criterion. Removing outline: none and restoring a visible focus style fixes 2.4.7 and helps you clear the 2.4.13 appearance bar, but it does nothing about an element being physically covered by a sticky header or banner. You need both: a visible, high-contrast indicator, and layout CSS (like scroll-margin-top) that keeps it from being covered when the browser scrolls it into view.
How much contrast does a focus indicator need under WCAG 2.4.13?
At least a 3:1 contrast ratio between the pixels in the focused and unfocused states, and an indicator area at least as large as a 2 CSS pixel thick perimeter outline around the component. These are the specific thresholds set in the WCAG 2.2 specification for the Focus Appearance criterion.
Is WCAG 2.4.13 required for ADA Title II compliance?
Not directly. ADA Title II requires WCAG 2.1 Level AA, and 2.4.13 is a Level AAA criterion added in WCAG 2.2, so it isn't a strict legal requirement for most public entities right now. It's still worth building to, since it gives you a concrete, testable definition of "good" focus styling instead of guessing — and many AA-level focus issues get caught along the way once you design against the AAA bar.
Conclusion
Focus visibility bugs are sneaky because they pass code review. The CSS looks right, the outline is there, the color contrast checker is happy — and then a real keyboard user tabs down the page and loses track of where they are the moment a sticky header swallows the thing they just focused. Test this one with your own hands on the keyboard, on both desktop and mobile widths, with any cookie banner or chat widget active. If you want a starting point for what else might be hiding in your markup, run your URL through AccessKnight's free WCAG and AI-readability scanner — it's a quick way to see what's already broken before you go looking for what a scanner can't catch on its own.
Fix guides for this topic
Step-by-step fixes with copy-paste code for the checks this article covers.
- Focus outline removed without replacementWCAG 2.4.7 · Level AAW3C: Understanding 2.4.7
- Positive tabindex valuesWCAG 2.4.3 · Level AW3C: Understanding 2.4.3
Check your website's accessibility
Scan against all 33 WCAG 2.1 rules and get code-level fix suggestions — free.
Run a free scan →