Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Appearence-none has browser inconsistencies #333

Closed
laurencei opened this issue Dec 22, 2017 · 6 comments
Closed

[Bug] Appearence-none has browser inconsistencies #333

laurencei opened this issue Dec 22, 2017 · 6 comments

Comments

@laurencei
Copy link
Contributor

Using appearence-none on forms is hit and miss depending on browsers.

Firefox has a red border on required fields if they remain empty:

image

And chrome likes to throw a blue focus on the input field:

image

I've made a CodePen here where you can see the issues by loading different browsers. https://codepen.io/anon/pen/ypabzP

Suprising IE works fine for once in my life 🤷‍♂️

@laurencei
Copy link
Contributor Author

Ok - so to fix the Chrome issue according to https://stackoverflow.com/q/2943548/1317935 we would need to change tailwindcss/src/generators/appearance.js

- 'appearance-none': { appearance: 'none' },
+ 'appearance-none': { appearance: 'none', outline: 'none' },

@laurencei
Copy link
Contributor Author

laurencei commented Dec 22, 2017

And to fix Firefox this works:

- 'appearance-none': { appearance: 'none' },
+ 'appearance-none': { appearance: 'none', box-shadow: 'none' },

So therefore can we do the following - and it should fix for everyone:

- 'appearance-none': { appearance: 'none' },
+ 'appearance-none': { appearance: 'none', outline: 'none', box-shadow: 'none' },

@tlgreg
Copy link

tlgreg commented Dec 22, 2017

Is this in the scope of tailwind?

Beside the reset there are no workarounds for browser inconsistencies. Utilities are generally map to a single css property. So if you wish to add these you could add utility outline-none shadow-none, though outline-none does not exists in the core.

As most utilities map to a css property value this change would feel like a side-effect to me under appearance-none.

@laurencei
Copy link
Contributor Author

I understand what you are saying.

But when you type appearance-none - you expect it to handle the suitation. i.e. it is a very explicit class with only one intention. It is kind of special type of normalizie that you are specifically applying to remove all the effects.

We already handle browser insonsitencies by adding -webkit etc to some properties - so in a way we are already doing it.

I think think is a special enough case for it, but I agree it should not be the norm.

Anyway - see where @adamwathan et al want to take it..

@adamwathan
Copy link
Member

Hey @laurencei! I don't consider this a bug, appearance-none just sets appearance: none. How the browsers behave with that property set is what it is. That utility is not supposed to do anything other than set that property to that value.

But when you type appearance-none - you expect it to handle the suitation. i.e. it is a very explicit class with only one intention.

It's explicit intention is to set the appearance property to none, that's all. appearance refers to how the browser adds special styling to controls, like adding a down arrow to a select box or adding up/down buttons to a number input. You can learn more about it here:

https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance

It would be extremely misleading for appearance-none to do anything other than appearance: none. To me that's like if font-bold also set background-color: green.

@tlgreg is right; if you want to remove the focus outline, use a utility designed to remove the focus outline. If you want to remove the box shadow, use a utility designed to remove the box shadow. appearance-none is for setting the appearance property, it's not called input-reset or something.

@laurencei
Copy link
Contributor Author

@adamwathan - ok - understood.

I've already added this as an extra CSS rule in my project to get around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants