Home / Fix guides / Accessibility (WCAG)

How to fix a missing focus indicator (CSS outline)

If pressing Tab on your site shows no ring or highlight on links, buttons and form fields, the site is hiding its focus outline, usually with outline: none in the CSS. The fix is to remove that rule or replace it with a clear :focus-visible style.

Press the Tab key on your website and watch the page. A visible ring, box or highlight should move from link to button to form field, so you always know where you are. If nothing shows, people who use a keyboard cannot tell what they are about to activate. The usual cause is one line of CSS, outline: none, added to make buttons look tidier.

What the problem looks like

Browsers draw a default outline around whatever element has keyboard focus. Many themes and CSS resets switch it off, often with rules like these:

*:focus { outline: none; }
button { outline: 0; }
a:focus { outline: none; }

The result: you tab through the menu, the search box and the checkout button, and the page looks completely still. Mouse users never notice, because the outline mostly appears for keyboard use. That is why this problem survives for years.

A second version is an outline that exists but is too faint, for example light grey on a white page, or one that is cut off or hidden behind a sticky header or cookie banner.

Why it matters

Some visitors cannot use a mouse at all: people with motor disabilities, people using switch devices or voice control, and people with a broken wrist or a dead trackpad. Others simply prefer the keyboard. For all of them, a missing focus indicator can make a form or checkout impossible to finish.

There are also practical business reasons:

  • Lost sales and enquiries. A visitor who cannot see where they are on your contact form or checkout will leave.
  • Legal and procurement risk. WCAG 2.2 requires a visible focus indicator (success criterion 2.4.7 Focus Visible, level AA). Accessibility rules in many countries point to WCAG, and larger customers often ask for it.
  • Trust. A site that feels broken for some visitors reflects on the whole business.

WCAG 2.2 also adds 2.4.11 Focus Not Obscured (Minimum), which means a focused item should not be completely hidden behind something like a sticky bar.

How to check your site for free

The best test takes one minute and needs no tools:

  1. Open your home page and click once on a blank area of the page.
  2. Press Tab repeatedly. Press Shift+Tab to go backwards.
  3. Watch for a clear outline or highlight on every link, button, menu item and form field.
  4. Try the page types that matter most: the contact form, search, and the cart or checkout.
  5. Press Enter on a focused link or button, or Space on a button, to make sure it actually works.

If you lose track of where you are at any point, that spot has a problem. For a technical check, open your browser developer tools (usually F12), search the Styles panel or your theme's CSS files for outline: none, outline: 0 and outline: transparent. The free Lighthouse audit in Chrome and the WAVE browser extension can flag some related issues, but they often miss focus problems, so the Tab test is the one to trust.

SiteMonday checks this in week 7, the WCAG 2.2 accessibility audit, and the written report lists the pages affected in a ranked fix list. You can read about that week at /week/7/.

How to fix it in general

There are two parts: stop hiding the outline, then make sure it is easy to see.

Step 1: find the rule that removes it. Search your theme CSS, your custom CSS box and any plugin styles for outline. The rule might sit on *, a, button, input or a class name.

Step 2: delete it or replace it. The simplest fix is to delete the rule. If you want a nicer look than the browser default, use :focus-visible, which shows the outline for keyboard users and usually not for mouse clicks:

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}

Pick a colour that stands out against your background. A good aim is a contrast ratio of at least 3 to 1 against the colours next to it. If your site has both light and dark sections, you may need two colours.

Step 3: avoid swapping the outline for nothing. Some themes replace the outline with a box-shadow or a background change. That can work, but note that in Windows high contrast mode, shadows can disappear while outlines stay visible. A real outline is the safest choice.

Step 4: check that nothing covers the focused item. If a sticky header hides links as you tab down the page, add scroll-padding-top to the html element, set to roughly the height of the header.

Fixing it on common platforms

Where you add the CSS depends on your platform, theme and version, but these are the usual places:

  • WordPress: Appearance, Customize, Additional CSS, or the Site Editor's styles panel in block themes. See the WordPress guide.
  • Shopify: the theme's CSS files in the code editor (look for base.css or similar in many themes), or the theme settings. See the Shopify guide.
  • Wix, Squarespace, Webflow: each has a custom CSS or custom code area, though what you can change differs by plan and editor. Guides: Wix, Squarespace, Webflow.
  • Elementor and React: in Elementor, custom CSS in the site settings or the widget; in React apps, the global stylesheet or component styles. Guides: Elementor, React.

If the outline is still missing after adding your rule, another rule is probably winning. In developer tools, click the element and look at the Styles panel to see which rule crosses out yours.

One related cause: if a clickable item is built from a plain div instead of a real button or link, it may not receive focus at all. See div used as a button.

How to confirm the fix worked

  1. Clear your site cache and your browser cache, or use a private window.
  2. Repeat the Tab test on the home page, a content page, the contact form and checkout.
  3. Confirm every interactive item shows a clear outline, including menu dropdowns, pop-ups and the cookie banner.
  4. Check the page at a narrow width, as mobile menus often have their own styles.
  5. Try it in at least two browsers, such as Chrome and Firefox, or Safari if you have a Mac.

How to stop it coming back

The problem usually returns when a theme is updated, a new plugin adds its own CSS, or a designer restyles buttons.

  • Add a line to your design brief: never remove focus outlines without replacing them.
  • Keep your focus style in one place, such as one custom CSS block, and note where it lives.
  • Do the Tab test after every theme change, new form or new page template.
  • Ask your developer to avoid global outline: none rules.
  • Re-test regularly. SiteMonday audits accessibility in week 7 of every year, so the issue gets re-checked there. Fixing is up to you or your developer, and fixes can be quoted separately.

Step by step for your platform

Questions

Why does my site have no focus outline?

Almost always because a theme, CSS reset or custom style contains `outline: none` or `outline: 0`. It is often added to make buttons look cleaner without anyone replacing it with another visible style.

Is it safe to hide the outline for mouse users only?

Yes, that is what `:focus-visible` is for. Browsers show the outline when you use the keyboard and usually hide it for mouse clicks, so you keep a clean look without harming keyboard users.

Is a missing focus indicator a WCAG failure?

Yes. WCAG success criterion 2.4.7 Focus Visible (level AA) requires that keyboard focus can be seen. Version 2.2 also adds 2.4.11, which says focus should not be completely hidden by other content.

What colour should a focus outline be?

Choose a colour that clearly stands out from both the element and the background around it, aiming for a contrast ratio of at least 3 to 1. A 2 to 3 pixel solid outline with a small offset is easy to see.

Can I fix this without a developer?

Often yes. If your platform has an Additional CSS or custom code area, you can paste a `:focus-visible` rule there. If the problem comes from deep inside a theme or app, ask a developer.

Will an accessibility plugin or overlay fix it?

Not reliably. The dependable fix is in your site's CSS, and you should confirm it yourself by tabbing through the pages that matter most.

Related problems