-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Prop with explicit "down" behavior overrides implicit "up" behavior of preceding prop #119
Comments
As the library is mobile-first by default, any .composition {
padding: 10px;
@media (max-width: 768px) { /* prop with a "down" behavior */
padding: 20px; /* will be "20px" on mobile as well */
}
} Perhaps, listing down behavior is not compliant with the mobile-first approach. I see two ways of solving this issue:
|
It would be nice to have this fixed, yet it's likely that this API would be deprecated in the future (#165). There must be a way to resolve this CSS specificity issue without altering the library's API. |
CSS-wise, there is no API to separate such two rules specificity, as the second one's will always be higher by the fact of later declaration, and the application surface. We are speaking about the scenario when the screen satisfies the media query, but the root-level property must be applied (see the beginning of the thread). .element {
color: red;
@media (max-width: 700px) {
// When should I stop being blue and become red?
// There is no programatic way to tell.
color: blue;
}
} That's not a CSS issue, but the issue with how a media query is constructed for the responsive props with the "down" suffix. I think such responsive props declarations should:
ExamplePreceding sibling prop present<Composition
templateCols="200px auto"
templateColsSmDown="400px 1fr"
/> When parsing
/* "xs" prefix "sm" closed breakpoint */
@media (min-width: 500px) and (max-width: 576px) {
grid-template-columns: 400px 1fr;
} Preceding sibling prop missing<Composition
padding={10}
templateColsSmDown="400px 1fr"
/> When parsing
@media (max-width: 576px) {
grid-template-columns: 400px 1fr;
} Technical aspectSuch changes may require to refactor the way |
Due to the amount of possible variations in responsive props declaration, I suggest the solution to this problem would be as simple as possible:
All the other use cases are rather abstract and not likely to appear in real world usage. I wouldn't invest time and library's size into figuring out how to treat them until a real necessity arises. |
Why:
Wrong prioritization of up/down props.
Environment:
0.6.2
Steps to reproduce:
Steps to reproduce the behavior:
On
xs
screens thegrid-template-columns
value will still be400px 1fr
(originating fromtemplateColsSmDown
.Expected behavior:
Props with "down" behavior indeed fill any gaps below them, but when any explicit prop is met (i.e.
templateCols
forxs
), this explicit prop must take the highest priority.Roadmap
The text was updated successfully, but these errors were encountered: