What this thread does
The problem
The default blue focus ring looks ugly, so the agent adds outline: none or focus:outline-none and moves on; keyboard users then cannot see where they are (a failure of WCAG focus visibility). Related reports: focus:outline-none not working Tailwind CSS on Stack Overflow and the Tailwind issue outline-none doesn't work on button with focus in chrome.
What Tailwind's v4 upgrade guide says
The old outline-none set an invisible outline that still shows in forced colors mode, for accessibility. In v4 it was renamed outline-hidden, and a new outline-none really sets outline-style: none. The guide's migration is to replace focus:outline-none with focus:outline-hidden. Ring defaults also changed: ring is now 1px and currentColor, so rings you relied on may look different.
What to tell the agent
- Never remove the outline without a replacement. Use
:focus-visible(Tailwindfocus-visible:), which shows for keyboard focus and mostly not for mouse clicks. - Example:
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600, orfocus-visible:ring-2 ring-offset-2if you use rings. Keep contrast against the background. - In v4 prefer
outline-hiddenoveroutline-nonewhen you also add your own ring. - After the change, press Tab through the page and check that every control shows a ring; a mouse click on a button generally will not.
A prompt worth trying (mine, untried): "Search for outline-none, outline: none and focus:outline-none. For each, add a visible focus-visible style with at least a 3:1 contrast against its background. Then tab through the page and list any control with no visible focus."
Common mistakes
Using :focus instead of :focus-visible (styling every focused element regardless of input method), a ring that matches the background, and overflow: hidden on a parent clipping the ring.
Limits
I did not run these prompts or reproduce the bugs; the CSS behaviour is from the cited docs.
Primary source
- Primary source: Upgrade guide - Tailwind CSS (v4) (Tailwind CSS)
- v3
outline-noneset an invisible outline that still shows in forced colors mode; v4 renames that tooutline-hidden, and the newoutline-nonesetsoutline-style: none. Defaultringchanged from 3px blue-500 to 1pxcurrentColor. (doc)
Sources
Checked against primary sources:
- Tailwind CSS v4 upgrade guide:
outline-nonerenamed tooutline-hidden, a newoutline-nonesetsoutline-style: none, migrationfocus:outline-nonetofocus:outline-hidden; defaultringchanged from 3px blue-500 to 1pxcurrentColor. Matches. - WCAG 2.2 Understanding Focus Visible: success criterion 2.4.7, level AA, and technique C45 using
:focus-visible. MDN :focus-visible: matches for keyboard focus and generally not for a mouse click on a button. - Tailwind issue 1231: closed.
Not checked here: the Stack Overflow question (Stack Overflow not opened), the 3:1 contrast figure in the sample prompt (our advice, not read from WCAG 1.4.11 here), and the example class lists. Nothing was run.
Started from a post by @Stack Overflow question by Thomas Read; Tailwind CSS v4 upgrade guide, packaged by the editor. Original post