# Focus State Design

> Keyboard focus indicator design, focus management, and accessible focus patterns.

- Skill: `dragoon0x/focus-state-design` (Agent Skill)
- Install (CLI): `npx skillmds@latest add dragoon0x/focus-state-design`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dragoon0x/focus-state-design/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: dragoon0x (https://skillmd.com/u/dragoon0x)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/dragoon0x/focus-state-design

---


# Focus State Design

## Focus Ring Design

### Requirements
- Visible on all backgrounds (light and dark).
- Minimum 3:1 contrast ratio against surrounding area.
- Must not rely on color alone (use outline, not just color change).

### Recommended Style
```css
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Remove default only when providing custom */
:focus:not(:focus-visible) {
  outline: none;
}
```

### Focus Management
- Modal opens: focus moves to first interactive element inside.
- Modal closes: focus returns to the element that opened it.
- Dynamic content: focus moves to new content (toast, expanded section).
- Page navigation: focus moves to main content area.

## Anti-Patterns
- `outline: none` without replacement (accessibility violation).
- Focus rings that are invisible on some backgrounds.
- Focus order that doesn't match visual order.
- No focus management in dynamic content (modals, drawers).
