Focus Ring
A high-visibility outline indicating which interactive element currently holds keyboard focus, essential for non-pointer navigation
Table of Contents
Structure Diagram
Shows ring on both mouse click & keyboard
- Mouse ClickLeaves ring visible after pointer click
- Common MistakeRemoving outline: none globally (breaks a11y)
- Still UsefulText inputs where active cursor matters
Crisp branded ring only for keyboard navigation
- Mouse ClickClean pointer clicks without lingering rings
- Keyboard Tab2px high-contrast ring + 2px offset
- WCAG 2.2Satisfies both visual craft and ≥3:1 contrast
What is Focus Ring?
A high-visibility outline indicating which interactive element currently holds keyboard focus, essential for non-pointer navigation. It is a core concept in Design Systems within UI / UX.
Core Principles
A Focus Ring acts as the cursor for anyone navigating by keyboard (Tab, arrow keys) or assistive switches. Stripping it with outline: none is equivalent to hiding the mouse pointer for pointer users.
Using the modern :focus-visible pseudo-class lets teams keep mouse clicks visually clean while displaying a crisp, branded focus indicator whenever keyboard navigation or text input occurs.
Practical Takeaways
- Never delete focus styles without a replacement: Style
:focus-visiblewith at least a2pxring and≥3:1contrast against adjacent colors. - Use
outline-offsetor dual-tone rings: Addingoutline-offset: 2px—or pairing an inner dark ring with an outer light ring—ensures visibility over light, dark, and photo backgrounds alike. - Prevent clipping inside
overflow: hidden: Switch to an inset ring (outline-offset: -2px) on tightly clipped cards or scrollable cells so the indicator is never sliced off.
Notable Examples
- System-wide focus utilities: Applying a consistent
focus-visiblering token across every button, link, input, and tab primitive. - Forced-colors resilience: Keeping
outline: 2px solid transparentalongside custombox-shadowrings so Windows High Contrast Mode still renders outlines. - Composite card focus: Using
:focus-withinto outline an entire interactive card cleanly.