Make focus visible in every display mode
8 steps · about 2 h 37 min · Intermediate
- Use CSS to change presentation on focus (guide, W3C Web Accessibility Initiative, 22 min)
Start with a technique that makes focus presentation an explicit authored state.
- Measure focus appearance (guide, W3C Web Accessibility Initiative, 28 min)
Evaluate size, contrast and persistence rather than relying on a vague impression of visibility.
- Target modality-aware focus styling (reference, MDN Web Docs, 18 min)
Add a strong indicator when the browser determines that focus should be evident.
- Highlight a focused composite region (reference, MDN Web Docs, 16 min)
Reveal context around a nested field or control without moving focus itself.
- Build a non-layout-shifting indicator (reference, MDN Web Docs, 18 min)
Use outlines without changing box dimensions or clipping the control's content.
- Adapt to forced colours (reference, MDN Web Docs, 20 min)
Let system colors preserve contrast when the user's display mode overrides authored colors.
- Avoid disabling user colour choices (reference, MDN Web Docs, 15 min)
Recognize the rare cases for preserving authored colors and the risk of opting out broadly.
- Test a two-colour focus indicator (guide, W3C Web Accessibility Initiative, 20 min)
Use adjacent contrasting colors so the indicator survives both light and dark surroundings.