Skip to content

[v4] :focus-visible no longer overrides default outline for some reason #15152

@HiggsWRX

Description

@HiggsWRX

What version of Tailwind CSS are you using?

4.0.0-beta.2

What browser are you using?

Checked on firefox, chrome, safari

What operating system are you using?

macOS

Reproduction URL

Just try to focus buttons

Broken on v4:

https://play.tailwindcss.com/x9buJChfyQ

Working on v3, was working on v4 before beta 2 (or 1?)
https://play.tailwindcss.com/GlVJmoYF6H

Describe your issue

One common pattern used was to set outline-none as a base style and then just override it when focused with a focus-visible:outline-red-500 for example. The choice between outline and ring is a discussion for another time but shadcn-ui for example uses this pattern a lot.

After the latest betas, this no longer works as you can check on the repro links.

For it to work, instead of outline-none as base we need to focus-visible:outline. Don't know if this is known and intended or a side effect from another change that went unnoticed.

PS: seems like this is broken in safari no matter the version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions