Skip to main content

How to fix missing focus indicators without ruining your design

When someone tabs through a page, they need to see where they are. A focus indicator is that visible mark — a ring, a bar, a strong outline — around the link, button, or field that currently has keyboard focus. If you have ever tabbed into a page and lost the cursor, you have felt the problem.

Good focus styles can match a brand. They just cannot be so subtle that they disappear. This guide is general information, not legal advice.

What "focus" is

Keyboard focus is the point on the page that will receive the next keystroke. Mouse users often click and never notice it. Keyboard users depend on it. If the indicator is missing, they are navigating blind even if they can see the screen.

  • 2.4.7 Focus Visible (WCAG 2.1) — there is a way to see the keyboard focus.
  • 2.1.1 Keyboard — if you cannot find the control, you cannot operate it.
  • 2.4.11 Focus Not Obscured (Minimum) is a WCAG 2.2 criterion. It asks that the focused item not be entirely hidden by other content, such as a sticky header. The Title II government rule still points to WCAG 2.1, but this 2.2 idea is still worth following on any modern site.

The most common bad pattern: outline: none

Many style sheets include something like this:

a, button, input, :focus { outline: none; }

That removes the browser's default ring, usually to make click styles look cleaner, and it leaves keyboard users with nothing. If you remove the default outline, you must put back a clear replacement.

:focus versus :focus-visible

:focus styles every focus, including some mouse clicks. :focus-visible is the modern way to show a strong ring mainly when the browser believes it is helpful — typically keyboard use. That is usually what designers want.

:focus { outline: none; } /* do not do this alone */

:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 2px;
}

Keep a fallback for older browsers if you still support them, or use :focus with care so mouse click styles do not fight you.

What makes a good indicator

  • It is easy to see against both light and dark backgrounds. A 3 to 1 contrast with the adjacent background is a useful target, and many teams go stronger.
  • It is not only a slight color shift or a shadow that blends into the card.
  • It is not clipped by overflow: hidden on a parent.
  • It remains visible when a sticky header or a cookie banner is on the screen.

A two-pixel offset ring in a brand blue or a high-contrast cream-and-navy combination is often enough. You do not need a thick neon box on every element, but you do need something obvious.

Brand-friendly examples

Buttons and links

button:focus-visible,
a:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 3px;
}

Form fields

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 2px;
  border-color: #052a5d;
}

Navigation and icon buttons

Give icon-only buttons a little offset so the ring is not cramped, and make sure the skip link — when it appears — uses the same family of styles.

Custom cards and tabs

If a whole card is a link, put the focus style on the link (or use :focus-visible within the card) so the entire hit area is obvious. For tabs, style the selected tab and the focused tab in different, visible ways so people can tell them apart.

Sticky headers and overlapping UI

A focused link that slides under a sticky header is, for practical purposes, invisible. Leave space, shrink the header when focus moves behind it, or scroll the focused item into a clear gap. Cookie banners and chat widgets cause the same problem at the bottom of the page.

Manual testing

  1. Tab through the header, main content, forms, and footer.
  2. Confirm you can always see the focused control.
  3. Open menus, dialogs, and the mobile nav and repeat.
  4. Check light and dark sections, and buttons on photos.
  5. On a small screen, confirm a sticky bar does not cover the focused item.

Mistakes to avoid

  • Making hover and focus look the same, and both of them faint
  • Clipping the outline with overflow or a tight border radius without an offset
  • Styling buttons but not links, or the other way around
  • Assuming the browser default will show up after a CSS reset
  • Using a focus style that fails contrast on some of your backgrounds

Notes for common platforms

WordPress. Theme resets and "one-click" style packs often strip outlines. Add your :focus-visible rules after the theme CSS, and check the block editor's front end.

Shopify. Check the cart drawer, header, and any app buttons that inject their own CSS.

Webflow. The designer sometimes looks fine because click focus is hidden. Publish and tab through the live site.

React and design systems. Put the focus style in the shared component library so every new button inherits it.

Official references: 2.4.7 Focus Visible and, in WCAG 2.2, 2.4.11 Focus Not Obscured. If you want help with a small-business site, text 910-931-0978 or see my resources page.