CKTIS / CSS
:focus-visible — conditional focus indicator
The :focus-visible pseudo-class matches a focused element when the browser determines that it should be visibly indicated.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
:focus-visible { /* declarations */ }:focus-visible matches a focused element when the browser determines that a visible indicator is needed. Unlike :focus, it does not match every focus situation. It does not move focus.
It does not simply mean “keyboard focus”: text inputs may match after clicking, too. Matching depends on browser heuristics and user preferences; navigating with Tab typically triggers it.
Use this pseudo-class to style the indicator. Do not globally remove outlines without a visible replacement. The example preserves default styling outside the match.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Focus indicator</title>
<style>
body { background: white; color: black; padding: 2rem; }
button:focus-visible {
outline: 3px solid #005fcc;
outline-offset: 3px;
}
</style>
<button type="button">Continue</button>
</html>Result
When the button matches :focus-visible, it has a solid 3px #005fcc outline offset by 3px. No console output.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.