{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-focus-styles-9ed8763526ba","title":"Ensure Visible Custom Focus Indicators","summary":"Ensure keyboard navigable elements have visible focus indicators with at least 2px solid outline, 3:1 contrast ratio, and use :focus-visible for accessibility and WCAG compliance.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-styles-9ed8763526ba","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-focus-styles-9ed8763526ba","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-styles-9ed8763526ba.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-focus-styles-9ed8763526ba\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Verify that :focus-visible is used instead of :focus, and ensure focus indicators are not clipped by overflow: hidden or misplaced due to stretched-link patterns.","instructions":"---\nname: focus-styles\ndescription: \"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.\"\nmetadata:\n  category: css\n  priority: high\n  difficulty: beginner\n  estimatedTime: \"15\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/css\/focus-styles\n---\n\n# Provide visible custom focus indicators\n\nUsers 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.\n\n## Quick Reference\n\n- Never use outline: none or outline: 0 without a visible :focus-visible replacement\n- Use :focus-visible instead of :focus to show indicators only during keyboard navigation\n- Focus indicators must have 3:1 contrast ratio against adjacent colors (WCAG 2.2)\n- Provide at least 2px solid outline with an offset for a high-quality focus ring\n- If a focus ring is drawn with pseudo-elements, verify it is anchored to the correct positioned element and not clipped by `overflow: hidden`\n- 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\n\n## Check\n\nFind 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.\n\n## Fix\n\nReplace outline: none on :focus with :focus-visible styles that provide a clearly visible custom focus ring with appropriate contrast.\n\n## Explain\n\nExplain the difference between :focus and :focus-visible, why focus styles matter for accessibility, and how to design an accessible focus ring.\n\n## Code Review\n\nReview 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.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/css\/focus-styles\n","use_cases":["Reviewing CSS for missing or incorrect focus indicators","Auditing a website for accessibility compliance","Fixing focus styles in a component library"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/focus-styles\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T16:13:13.000000Z","updated_at":"2026-11-23T04:55:09.000000Z","seo_title":"Ensure visible custom focus indicators for accessibility","seo_description":"Ensure keyboard navigable elements have visible focus indicators with proper contrast and styling to improve accessibility and meet WCAG standards.","seo_keywords":["accessible focus indicators","keyboard navigation focus","WCAG 2.4.7 compliance","custom focus ring styles","focus-visible CSS"]}}