Free guideThe newsletter. Real UI fixes by email, and a free 35-page guide to AI design skills.
Ship Better UI

, 1 minute 21 seconds

Should you remove the focus outline in CSS?

The rule

Never ship outline: none. Draw a 2 px ring 2 px outside each control, at 3:1 contrast or more, on :focus-visible.

Try it

Apply the fix

Prompt for your AI coding tool

Paste it into Claude Code, Cursor or any AI coding tool, then share the page you want fixed.

Review the interface I share for how it shows keyboard focus. Fix what breaks these rules, and change nothing else.

1. Never remove the focus outline: find every outline: none or outline: 0 on focus and take it out.
2. Ring: draw a 2px solid outline, 2px outside the element: outline: 2px solid <your colour>; outline-offset: 2px;
3. Contrast: give the ring's colour 3:1 contrast or more against the page behind it.
4. Use :focus-visible, not :focus, so mouse clicks on buttons skip the ring and Tab still shows it.

Keep the content, the layout and the colours. When you are done, list each rule you changed: its selector, what it was, and what it is now.

More prompts like this in the free guide 

The problem

The sign-up form in the video sets outline to none. That outline is the focus ring, the line that shows where the keyboard is. Tab moves through Email and Password, where a blinking caret gives the field away, then on to the checkbox and Create account. There, nothing tells you where you are.

The fix

  1. Draw a 2 px ring, 2 px outside the element. outline: 2px solid #ff9874; outline-offset: 2px; The offset keeps the ring off the button's edge.
  2. Give it 3:1 contrast or more. The orange in the video is 8.6:1 against the page.
  3. Use :focus-visible, not :focus. With plain :focus, the ring also shows on every mouse click. With :focus-visible, clicks on a button skip the ring, and Tab still shows it.

Why it works

A keyboard user has no pointer. The focus ring is the only sign of which control the next key press acts on, so without it they guess. Designers usually delete it because it shows on mouse clicks too. :focus-visible removes that reason: the ring appears when the keyboard moves focus and stays off a clicked button. WCAG 2.4.7 Focus Visible says keyboard focus must show, and WCAG 2.4.13 Focus Appearance asks for at least 2 px, at 3:1.

How to apply it

Search your CSS for outline: none and outline: 0. Replace each with one rule on :focus-visible: a 2 px solid outline in a colour with 3:1 contrast or more against the page, and a 2 px outline-offset. Then put the mouse away and Tab through every screen. Each control should show the ring when it has focus, and a click on a button should not.

Free guide · 35 pages

Get fixes like this by email

Join the newsletter and get the 35-page guide to AI design skills: the skills, the order to use them in, and prompts to copy.

Watch it on

More on interaction

All 8 lessons on interaction