Remove the default button outline from normalize.css #3510
justingolden21
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
By the way, this is off topic, but it seems that in |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hey! No plans to fork normalize and change it I'm afraid, so I would recommend just authoring your global focus styles the way you demonstrated: *:focus, button:focus {
@apply outline-none ring-2 ring-indigo-500 ring-opacity-50;
} Not really an annoying or high effort solution. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Every time anyone ever writes code about the
:focus
state of something, they need to explicitly mentionbutton
as well because of this.Example:
does not work and the TailwindCSS user must specify
button
every time just to overwrite this style:Reasoning
This seems against Tailwind's motto of being "unopinionated" and makes code harder to write.
The CSS above can be vaguely translated into:
Which works like so on focused

buttons
:As well as links:

However, remove the explicity mention of
button
:And we get this in Chrome:

this in Firefox:

and this in Edge:

Yuck.
Solution
The culprit is this line created inside TailwindCSS:
Removing this line cleans everything back up:
Chrome:

Firefox:

Edge:

Counterargument Rebuttal
I understand that the default outline is there to make sure buttons are shown an outline if no styles are provided.
However, this impedes on the user writing their own styles, and creates inconsistency within the user-interface, which are two things I believe Tailwind is very much opposed to.
Beta Was this translation helpful? Give feedback.
All reactions