-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fluid typography: use layout.wideSize as max viewport width #49815
Fluid typography: use layout.wideSize as max viewport width #49815
Conversation
Size Change: +2.86 kB (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
Flaky tests detected in ad7e599. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4696069775
|
8c5b1be
to
f5630e1
Compare
…mum font scale that tapers out as the font size increases. The calculation is only performed where there no min font size is passed to the fluid font size methods. The min font scale factor is constrained by min and max values. Tests are updated to reflect the new clamp values. Docs are updated to reflect API change in JS function (removing minimumFontSizeFactor arg)
ad7e599
to
3f23a05
Compare
UX-wise, the font size fluidity is much more expected. I like this. |
- elaborates on the purpose of layout.wideSize in the theme.json schema
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.
Works well!
For folks like me who disabled the wide alignment by passing |
Hi @mateuswetah Good question! Yes I can confirm that |
…maximum viewport size in relation to calculating fluid fontsize values. Unfortunately this maxViewPortWidth value was not being passed to `getTypographyFontSizeValue()` This commit correct this omission and adds extra unit tests to both the JS and PHP versions.
…1146) * #49815 added `settings.layout.wideSize` as the default value for the maximum viewport size in relation to calculating fluid fontsize values. Unfortunately this maxViewPortWidth value was not being passed to `getTypographyFontSizeValue()` This commit correct this omission and adds extra unit tests to both the JS and PHP versions. * To avoid backwards compat problems I'm trying to keep the function signature the same, hence the gymnastics here. Because we support fluid: true and fluid: {...values}, we have to ensure the param object is correctly set so that we can know if fluid typography is enabled or not. The alternative could be a third argument to the `getTypographyFontSizeValue()` function, e.g., `isFluidEnabled` * My blod is typo * Why chain? Break the chains!
…rdPress#51146) * WordPress#49815 added `settings.layout.wideSize` as the default value for the maximum viewport size in relation to calculating fluid fontsize values. Unfortunately this maxViewPortWidth value was not being passed to `getTypographyFontSizeValue()` This commit correct this omission and adds extra unit tests to both the JS and PHP versions. * To avoid backwards compat problems I'm trying to keep the function signature the same, hence the gymnastics here. Because we support fluid: true and fluid: {...values}, we have to ensure the param object is correctly set so that we can know if fluid typography is enabled or not. The alternative could be a third argument to the `getTypographyFontSizeValue()` function, e.g., `isFluidEnabled` * My blod is typo * Why chain? Break the chains!
Tracking issue:
About
A pull request that uses the value of
settings.layout.wideSize
, if set, as the maximum viewport width for fluid font size calculations.The default value is
1600px
.See #49707 (review) for context
What's the point?
To give finer control to editor users and theme builders.
When constraining the maximum viewport width to
settings.layout.wideSize
, fluid font sizes will cease to increase when the viewport reaches a maximum width.This is a good thing! Why? Because it allows folks to more accurately set maximum custom font sizes for their layouts. By "custom font size", I'm talking about single-value font-sizes set in the editor or theme.json that have no other instructions on how their fluid values are calculated. Contrast this with font size preset items, which permit min and max font size values.
So when calculating clamp values for fluid font sizes, Gutenberg uses the custom font size value as the maximum. The user will then know that this will be the maximum font size within the maximum "wide" layout size.
Does that make sense? 🤷
How?
Grabbing the value of
settings.layout.wideSize
.Testing Instructions
layout.wideSize
2023-04-14.13.29.09.mp4