Many websites remove the default browser focus outline with 'outline: none' for aesthetic reasons, but this makes the site completely unusable for keyboard users. They can't see which element is currently focused. The fix isn't to keep the ugly default — it's to design a better focus indicator.
*:focus {
outline: none;
}/* Remove only for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
outline: none;
}
*:focus-visible {
outline: 2px solid #0066cc;
outline-offset: 2px;
border-radius: 2px;
}a:focus {
outline: 0;
text-decoration: none;
}a:focus-visible {
outline: 2px solid #0066cc;
outline-offset: 2px;
}
a:focus:not(:focus-visible) {
outline: none;
}button:focus {
outline: none;
box-shadow: none;
}button:focus-visible {
outline: 2px solid #0066cc;
outline-offset: 2px;
}
button:focus:not(:focus-visible) {
outline: none;
}Invisible focus indicators violate WCAG 2.4.7 (Focus Visible). The :focus-visible CSS pseudo-class is the modern solution — it shows focus styles only for keyboard navigation, not mouse clicks, satisfying both design and accessibility requirements.
ADA CodeFix scans your website for WCAG 2.1 AA violations and generates AI-powered code fixes — not vague descriptions, actual code you can copy-paste.
Scan Your Site FreeMissing alt text is the #1 accessibility violation. Learn how to add proper alt attributes to images with code examples and an automated scanner.
How to Fix Low Color Contrast in CSSLow color contrast is found on 80%+ of websites. Learn the WCAG contrast ratios, test your colors, and fix CSS contrast issues with code examples.
How to Fix Missing Form Input LabelsForm fields without labels are inaccessible to screen reader users. Learn how to properly label inputs with HTML label elements and ARIA attributes.
How to Fix Empty Links and ButtonsEmpty links and buttons with no accessible text are a top accessibility violation. Learn how to add descriptive text and ARIA labels with code examples.
How to Fix HTML Heading StructureSkipped heading levels and missing H1 tags hurt both SEO and accessibility. Learn how to create a proper H1-H6 hierarchy with code examples.
How to Fix Keyboard Navigation and Focus IssuesIf your website can't be navigated with a keyboard, it's inaccessible. Learn how to fix tab order, focus styles, keyboard traps, and custom components.