-
Notifications
You must be signed in to change notification settings - Fork 29
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
Remove Safari line-height browser bug fix (Orig title: Allow more options for line-height, e.g. unitless) #11
Comments
@ronilaukkarinen It is possible to do so by using |
Yes I know, but I rather not use |
This looks strange to me. As far as I know, adding a line-height definition after the typeset mixin should work as an override, at least for the breakpoint that you've specified it for. Note that each parameter of the typeset mixin can accept pixels, rems, or unitless numbers (which are interpreted as baseline units, ie: multiples of your current rootsize for that breakpoint). So you can actually currently enter Line height is also always output unitless, regardless of input. |
Hey there, I realised this is likely related to a webkit bug, and a subsequent fix I have implemented in MegaType for webkit browsers. I have opened a bug with webkit; with unitless line-height webkit sometimes renders the line-height differently to the computed height (which reports itself as the correct value in inspector and when queried, despite rendering incorrectly on-screen). For more information, check out the issue I opened, and the contained codepen that demonstrates the issue. https://bugs.webkit.org/show_bug.cgi?id=155286 In MegaType, this results in type shifting off the grid sometimes on long pages, which can add up to a big problem. The fix in MegaType is output as something like: @media screen and (-webkit-min-device-pixel-ratio: 0) {
dd, dt, figcaption, p {
line-height: 2rem;
}
} Which is a just a browser hack to apply line-height in As this is temp fix, and will be removed from MegaType soon, I recommend implementing something like the following, also as a temp fix until this is resolved in webkit. @mixin lineheight($val) {
line-height: $val;
@media screen and (-webkit-min-device-pixel-ratio: 0) {
line-height: $val;
}
}
@include min-width(3 4) {
@include typeset($sans, 18px, 36px, 0, 2);
@include line-height(1.5);
} I know this isn't ideal, but when MegaType removes this fix, you can also update the above mixin to remove the browser hack, or find/replace to remove the mixin altogether. I'll leave this issue open to track the status of the webkit bug and subsequent removal of the MegaType fix. |
I'm no longer replicating this in latest webkit, assume it's been resolved, so am removing the fix from MegaType. Should now be easier to override |
Scratch that, further testing is turning up some edge cases that are still rounding incorrectly |
As this adds a lot of media query calls, and is only still a problem in Safari as far as I can see, I've added a config option to turn it off globally if it's not important in a project to have to-the-pixel precision in Safari. For example, this is common if working on a vertical rhythm in a single column, as it will never appear misaligned beside other content in an adjacent column. Here's the default, but set to
|
I love using megatype for responsive typography, but in every element modular scale is not needed or necessary, but even for those elements it's nice to have "automated" sizing. However, if I set the type with
typeset
-mixin, I can't override line-height value. Here's an example:Is it possible to have it like this:
@include typeset($sans, 18px, 1.5, 0, 2);
, or that the mixin would respect the definition after it?The text was updated successfully, but these errors were encountered: