-
Notifications
You must be signed in to change notification settings - Fork 172
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
u-hide utilities' breakpoints deviate from expected screen size values #5287
Comments
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/WD-14040.
|
How to reproduce it? How can I get fraction of pixel width to test it? |
Overall I think the fix for that would be switching to range queries for utilities. What's causing the issue right now is the vanilla-framework/scss/_utilities_hide.scss Lines 20 to 40 in 6c5c7ce
To fix that we need to replace those with .u-hide {
display: none !important;
&--small {
@media (width < $breakpoint-small) {
display: none !important;
}
}
&--medium {
@media ($breakpoint-small <= width < $breakpoint-large) {
display: none !important;
}
}
&--large {
@media ($breakpoint-large <= width) {
display: none !important;
}
}
} This probably applies to ALL utilities that use responsive variants. It's probably OK to leave grid as is, because grid doesn't use exclusive ranges (min-width and max-width), but only overlapping ranges (always min-width), so there is no gap between them. |
I was able to just opening DevTools as a left/right panel and dragging it around manually, but I'm only on a 1080p screen, so that might be harder to achieve on a high-density display. I'll look into a more programmatic way to repro this. |
As far as I remember this could have been also OS related. So only on some OSes (Ubuntu?) it was possible to get fraction of |
Describe the bug
At exactly between 1035px and 1036px (inclusive), there's a clash between u-hide and the grid definitions as a result of these lines:
https://github.com/canonical/vanilla-framework/blob/main/scss/_utilities_hide.scss#L30
https://github.com/canonical/vanilla-framework/blob/main/scss/_base_grid-definitions.scss#L62
This means the medium hidden hr element becomes visible for a tiny slice before the large grid styles kick in.
Though grid is used to explain this issue, it is likely that the values used for the u-hide utilities are causing similar clashes with other responsive components in the library.
The solution is probably to change u-hide breakpoints, which would alter u-hide functionality across the entire library. Our components and examples that use u-hide utilities will need to be assessed for issues as a result of this change.
Expected behavior
u-hide utilities should possess the same responsive breakpoints as all other components, so elements utilizing these classes are shown/hidden as expected and in alignment with other components' breakpoints.
Screenshots
Here's a screenshot of this occurring on the Equal Height Row component - the divider is shown at 1035.72px, mistakenly being displayed right before the grid changes layout at 1036px:
The text was updated successfully, but these errors were encountered: