tailwindlabs / tailwindcss-forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
https://tailwindcss-forms.vercel.app
MIT License
4.15k stars 218 forks source link

Can't override outline style #78

Closed nino-w4u closed 3 years ago

nino-w4u commented 3 years ago

What version of @tailwindcss/forms are you using?

v0.3.3

What version of Node.js are you using?

16.8.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction repository

https://play.tailwindcss.com/mLaNtgEjXG

Describe your issue

I'm trying to get rid of outline by adding outline-none on focus of input. But it doesn't seem to work when I add @tailwindcss/forms

adamwathan commented 3 years ago

Hey! The forms plugin doesn't use outline for the default focus style, it's a ring + border. So to remove the default, you'll want to do something like this:

<input type="text"
  placeholder="Custom focus style"
  class="focus:ring-0 focus:border-gray-500" />

This kinda feels weird I admit but it's the best we've got if we want focus styles to follow border radius. In practice a custom input usually ends up looking more like this:

<input type="text" class="rounded border-gray-300 focus:ring focus:ring-pink-400/50 focus:border-pink-500"/>

Live demo for example:

https://play.tailwindcss.com/2QakwKOwIV

Hope that helps!

JuanM04 commented 2 years ago

This kinda feels weird I admit but it's the best we've got if we want focus styles to follow border radius.

This was fixed in Chrome, Firefox and Safari a few months ago. Maybe, along the new outline-* utilities, it's time to update the default styles to use outlines instead of rings

adamwathan commented 2 years ago

@JuanM04 Not changed in Safari yet I'm afraid:

https://play.tailwindcss.com/LkVepR7iRE

Default outlines will follow border radius, but if you actually set the outline property yourself it will always have square corners.

JuanM04 commented 2 years ago

Oh, I didn't know that Safari behaves so weirdly. Let's wait until it supports it