Performance and accessibility 4 min read Updated
Focus indicators that stay visible and unhidden
In short
A focus indicator must be visible, keep at least 3:1 contrast with its surroundings, and never be covered entirely by a sticky header.
A keyboard user finds their way around a page by one thing: the focus indicator. If it is missing or too faint, they cannot tell which element is active. The WCAG 2.2 requirements for a visible indicator are worth knowing before a focus style is designed.
What focus visible requires
Success Criterion 2.4.7, Focus Visible, is Level AA. It requires that any keyboard operable user interface has a mode of operation in which the keyboard focus indicator is visible. The W3C summary asks that each item receiving focus has a visible indicator. The indicator must not be time limited, so once it appears it stays on screen while the element has focus.
The criterion does not prescribe a form. An outline, a border, a change of background or an underline can each satisfy it. What it does not allow is an indicator that disappears after a moment, or no indicator at all.
Focus indicator contrast
A focus indicator is a visual cue for a user interface component, so Success Criterion 1.4.11 applies to it. The indicator needs at least 3:1 contrast against the colours next to it. The W3C note on non-text contrast makes an exception for hover and state colour changes, but it states that focus indicators still must meet the requirement.
A common failure is a pale outline on a pale background. Such an outline can look clear in a design file and still fail the 3:1 test. Measure the focus colour against the actual background it sits on, not against white.
Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea
When a header hides the focus
Success Criterion 2.4.11, Focus Not Obscured (Minimum), is also Level AA. It requires that a focused component is not entirely hidden by author-created content. Partial overlap is allowed, but the W3C notes that the more of a component is covered, the harder it is to see.
Sticky headers, sticky footers and non-modal dialogs are the typical causes. A sticky header that completely covers a focused link fails the criterion, and the W3C lists this situation as failure F110. Scroll padding is the approach the W3C describes as passing, because it keeps the focused item clear of the fixed header when the browser scrolls it into view.
Styling without losing focus
Designers often remove the default outline because it clashes with the layout. That is acceptable only when something else takes its place. A rule that removes the outline and adds nothing in its place leaves no visible indicator, and it fails 2.4.7 as written. The focus style can be redesigned freely, but it must still be present, must contrast with its surroundings and must stay on screen while the element has focus.
The W3C also notes that a browser may show the indicator only during keyboard use. The author remains responsible for providing a mode in which the indicator is visible, so a design should not rely on the browser for it.
A focus check before release
- Tab through each template and each form, and confirm that a focus indicator is visible on every stop.
- Measure the contrast of the indicator against the background it sits on, for each button, link, field and tab.
- Scroll a long page until a control sits just below the sticky header, and confirm that the focused element is not hidden.
- Open each dialog and drawer, and check that the focused control inside it is not covered by the page chrome.
- Search the stylesheet for rules that remove an outline, and confirm that each one has a replacement.
Whether a control can be reached at all is covered in keyboard accessibility. The contrast figures used here are explained in colour contrast.
The criteria are quoted from the W3C Understanding documents for Success Criterion 2.4.7 and Success Criterion 2.4.11. Failure F110 is named in the W3C text for 2.4.11. The checks above are a working method, not a full audit.
Common questions
- Does a focus indicator have to be an outline?
- No. Success Criterion 2.4.7 does not prescribe a form, so an outline, a border, a change of background or an underline can each satisfy it.
- Can a sticky header cover a focused link?
- Not completely. Success Criterion 2.4.11 requires that a focused component is not entirely hidden by author-created content, and the W3C lists a sticky header that completely hides focus as failure F110.
- Does a focus indicator need 3:1 contrast?
- Yes. The W3C note on non-text contrast says that focus indicators still must meet the 3:1 requirement, even though hover and state colour changes do not.
Sources
- Understanding Success Criterion 2.4.7: Focus Visible, W3C (WCAG 2.2). Accessed 14 November 2026
- Understanding Success Criterion 2.4.11: Focus Not Obscured (Minimum), W3C (WCAG 2.2). Accessed 14 November 2026
Further reading
-
What keyboard accessibility asks for in WCAG 2.2
Every function must work from the keyboard, timing must not decide the result, and repeated blocks need a way to be bypassed.
-
Contrast ratios WCAG 2.2 requires for text and controls
Normal text needs a 4.5:1 contrast ratio, large text and interface components need 3:1, and each colour pair must be checked on its own.
-
What changed in WCAG 2.2 and what to check
The new criteria that most affect shops and sign-in are focus not obscured, target size and accessible authentication, and one pass can check them.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea