Skip to main content

Focus State

UI Design

What is a Focus State

A focus state is the visual indicator that shows which element has keyboard focus. When users press Tab to move through a page, the focus state, often a focus ring, shows where they are and what Enter will activate.

How a Focus State works

  • Outline or ring: Drawn around the focused element
  • High contrast: Visible against every background
  • Keyboard-first: The CSS :focus-visible selector shows it mainly for keyboard users
  • Every element: Links, buttons, inputs and custom controls

Focus State and accessibility

WCAG 2.4.7 (level AA) requires a visible focus indicator. The stricter WCAG 2.4.13 (AAA) asks for an indicator at least as large as a 2 px outline with 3:1 contrast between focused and unfocused states. Never remove the browser outline without a replacement.

Why Focus States matter

Keyboard and screen reader users rely on focus to navigate. Without it, they are lost on the page.

Frequently asked questions

Is a visible focus state required?

Yes. WCAG 2.4.7 (level AA) requires a visible keyboard focus indicator for any interface that can be used with a keyboard. Removing the browser outline without a replacement fails this rule.

How visible should a focus indicator be?

WCAG 2.4.13 (level AAA) asks for an indicator at least as large as a 2 CSS pixel outline around the element, with at least 3:1 contrast between the focused and unfocused look.

What is the difference between :focus and :focus-visible?

:focus matches whenever an element has focus, including after a mouse click. :focus-visible matches only when the browser decides focus should be shown, mostly for keyboard users, so designers can show a ring for keyboard use without showing it on every click.