-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[0.2] Support cascading border colors and styles #116
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
Conversation
b503c32
to
3a71685
Compare
css/preflight.css
Outdated
@@ -533,7 +533,7 @@ iframe { | |||
*::after { | |||
border-width: 0; | |||
border-style: solid; | |||
border-color: config('borderColors.default', black); | |||
border-color: config('borderColors.default', currentColor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To better match browser default behavior.
9ff4e5d
to
d9ac8d4
Compare
I think I'm suffering the consequences of this on version
The I'm hoping this will fix that??? |
I just took a look at the code changed and it looks like it will! Now to figure out how I can get this in my current version, or upgrading to |
I would work around it for now by just writing `border-style: dashed` in
your component instead of using `@apply` 👍🏻
…On Sat, Nov 11, 2017 at 9:57 PM Joel Taylor ***@***.***> wrote:
I just took a look at the code changed and it looks like it will! Now to
figure out how I can get this in my current version, or upgrading to 0.1.6
then getting it in that version. hmmmm
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#116 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEH3bGG8lLqWQC-OfMJxlSP6kAwtM59-ks5s1l6fgaJpZM4QTfkD>
.
|
@adamwathan - so simple a solution! Thanks mate. |
Rename `modules` to `variants`
This also removes default borders from input, select and textarea and produces some problems if one starts using Tailwind in an already existing application. My suggestion would be adding this:
|
Small heads-up on anybody building web components and using the :host {
border: 1px solid red;
} The only solution here is to use |
Previously all of our border width styles (
.border
,.border-2
, etc) worked by applying theborder
shorthand property.They would set the width to the specified width, but also set the style to
solid
, and the color to thedefault
color specified in theborderColors
config.This seemed convenient but has the consequence of resetting any border color overrides any time you change the border width at a breakpoint, for example:
This will have a 1px purple border on small screens, and a 2px grey border on medium screens.
This is pretty unintuitive, and we have the same issue with border styles (dashed, dotted, etc.)
This resolves all of this by setting a default border style, width, and color to all elements as part of preflight, that looks like this:
So every element by default will have a zero width border, set to the default border color.
The border width utilities now only set
border-width
, not the entireborder
shorthand. That means that the previous example:...will now retain the purple color at larger screens, because
md:border-2
is only overriding the width.This also removes the need for this gruesome
borderStyleReset
hack we had to apply, where any time you applied a border style, we also reset the border-width back to 0, but defined that portion of the class before the border width utilities so that those would still take precedence. This was the only place in the entire framework where one class had multiple definitions in different places, and actually leads to the bug discussed in #112.Overall this change dramatically simplifies this portion of the codebase, and also makes the behavior much more intuitive.
The only question is if there's any unintended consequences to the styles added to preflight. Testing suggests that everything is totally fine, but if anyone has questions or concerns feel free to bring them to our attention.
This is technically a breaking change, so even though we are still pre-1.0 and moving rapidly, it's probably wise to save this for 0.2 instead of an 0.1.x patch release.
Resolves #80.
Resolves #112.