Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

focus:outline-none does not remove the focus border in Tailwind

Errorfocus:outline-none has no visible effect on an input

Short answer

focus:outline-none only controls the CSS outline. A blue or black ring is often a ring utility (box-shadow) from your form markup, so remove it with focus:ring-0. In Tailwind v4 the old outline-none behaviour is called outline-hidden. If nothing changes, the class may not have been generated.

  • Applies to Tailwind CSS 4, Laravel 12
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the browser dev tools, focus the field and read the Styles panel. It shows whether the line comes from outline, from box-shadow (ring), or whether your class is missing from the stylesheet.

    grep -rn "outline-none\|outline-hidden\|focus:ring" resources/views resources/js | head
  2. 2Match what you see, then jump to its fix

    1. 1In dev tools the focus effect is a box-shadow (--tw-ring-shadow), and outline is already none.The ring is a ring utility, not an outlineFix
    2. 2The project was upgraded from v3 and fields now behave differently, or a transparent outline shows in forced-colors mode.Tailwind v4 renamed the utilities (outline-none vs outline-hidden)Fix
    3. 3Dev tools shows no rule for focus:outline-none at all.The class is never generated, so no CSS exists for itFix

What does the error look like?

  • focus:outline-none has no visible effect on an input
  • A ring still shows around the field when focused

Cause 1 of 3

The ring is a ring utility, not an outline

1Check

Ring utilities such as ring-2 or focus:ring draw their line with the --tw-ring-shadow variable, which is a different property from outline. outline-none cannot remove it.

grep -rn "ring" resources/views | head

2Fix

Remove the ring utility, or set its width to zero for the focus state.

<input class="focus:outline-none focus:ring-0" />

3Verify

Rebuild assets, reload and focus the field.

npm run build

Confirmed by tailwindcss.com

Did this fix it?

Cause 2 of 3

Tailwind v4 renamed the utilities (outline-none vs outline-hidden)

1Check

In v4 outline-none sets outline-style: none, while the old v3 behaviour, a transparent outline that stays visible in forced colors mode, is outline-hidden. The v4 upgrade guide also changed the default ring width from 3px to 1px.

grep -n "tailwindcss" package.json
grep -rn "outline-none" resources/views | head

2Fix

Pick the one you mean: outline-hidden keeps the accessible fallback, outline-none removes the outline completely. Give focused fields your own visible style either way.

<input class="focus:outline-hidden focus:border-indigo-600" />

3Verify

Focus the field in the browser and in a forced-colors setting if you support it.

npm run build

Confirmed by tailwindcss.com

Did this fix it?

Cause 3 of 3

The class is never generated, so no CSS exists for it

1Check

Tailwind v4 skips files in .gitignore and node_modules, and it cannot read class names that are built from pieces.

grep -rn "@source\|@import \"tailwindcss\"" resources/css

2Fix

Write complete class names in the template, and register ignored folders with @source.

/* resources/css/app.css */
@import "tailwindcss";
@source "../../vendor/acme/ui-kit/resources/views";

3Verify

Rebuild, reload, and check in dev tools that a rule for the class now exists.

npm run build

Confirmed by tailwindcss.com

Did this fix it?

How do I stop it coming back?

  • When you remove an outline, add your own visible focus style so keyboard users can see where they are.
  • After a major Tailwind upgrade, run the official upgrade guide's renames over your views.
  • Write full class names; never build them with string pieces.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

Laravel cannot find a Sass or JS entry in the Vite manifest

Unable to locate file in Vite manifest: resources/sass/app.scss

The @vite directive asks the built manifest for a file, and that file is listed only if it is an entry in the laravel() input option and the assets were built after adding it.

3 causes, each with a fix

Web apps

Hydration failed after adding next-themes dark mode

Console reports a server and client mismatch on the html element

next-themes changes the html element and knows the theme only in the browser, so server HTML and client HTML differ.

3 causes, each with a fix

Web apps

Next.js fails with Cannot find module 'tailwindcss'

Error: Cannot find module 'tailwindcss'

Next.js loads Tailwind through PostCSS, so the error means the package named in postcss.config is not installed where the build runs.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.