Skip to content
Skillpedia
Interfaces (UI/UX)75k · #2852

focus-styles

What it does

This skill checks whether a site shows a visible outline when keyboard users move between controls. It is for developers and designers who want accessible styling.

When to use it

  • ✓When your CSS removes the default outline from buttons or links.
  • ✓When keyboard users cannot see which control is selected.
  • ✓When you design a custom button or link style.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-styles/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-styles/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you make sure my buttons show a visible outline when I use the keyboard?”

5 new skills a week. 1 minute to read.

How it works

The agent searches the stylesheets for removed outlines and checks for a visible replacement. It suggests focus-visible styles with enough contrast and a clear offset.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Provide visible custom focus indicators

Users who navigate by keyboard (people with motor disabilities, power users, people in assistive technology contexts) rely entirely on focus indicators to know where they are on the page. Removing outlines without replacement makes an entire site unusable for keyboard users. WCAG 2.4.7 requires a visible focus indicator, and WCAG 2.4.13 defines a stronger size-and-contrast target for custom indicators.

Quick Reference

  • Never use outline: none or outline: 0 without a visible :focus-visible replacement
  • Use :focus-visible instead of :focus to show indicators only during keyboard navigation
  • Focus indicators must have 3:1 contrast ratio against adjacent colors (WCAG 2.2)
  • Provide at least 2px solid outline with an offset for a high-quality focus ring
  • If a focus ring is drawn with pseudo-elements, verify it is anchored to the correct positioned element and not clipped by overflow: hidden
  • If the component uses a stretched-link pattern, verify the visible focus ring follows the actual interactive element rather than a parent wrapper by accident

Check

Find all instances of outline: none, outline: 0, or :focus { outline: none } in this CSS. Check if they provide an alternative visible focus indicator. If the replacement uses pseudo-elements, also verify the ring cannot be clipped or misplaced by overflow or missing positioning context.

Fix

Replace outline: none on :focus with :focus-visible styles that provide a clearly visible custom focus ring with appropriate contrast.

Explain

Explain the difference between :focus and :focus-visible, why focus styles matter for accessibility, and how to design an accessible focus ring.

Code Review

Review stylesheets, component styles, and responsive states related to Provide visible custom focus indicators. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/focus-styles

FAQ

Why not just remove the outline?

Keyboard users rely on the outline to know where they are, so removing it makes the site hard to use.

What is focus-visible?

It is a CSS selector that shows the focus style mainly during keyboard navigation, not after a mouse click.

What contrast is needed?

The skill mentions a 3 to 1 contrast ratio against nearby colors for focus indicators.

Details

Original description by the author

Use when reviewing stylesheets, component styles, and responsive behavior related to Provide visible custom focus indicators. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2852
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills