-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Backport: Fluid typography - adjust font size min and max rules (#45536) #3602
Backport: Fluid typography - adjust font size min and max rules (#45536) #3602
Conversation
Failing PHPUnit 7.1 tests look unrelated |
- Where no fluid max values are set (e.g., single or custom font size values), the "size" value will act as the maximum value in a clamp() function. - Do not clamp value if a font size is lower than 14px - Always honor a supplied fluid.min value, the lower bound of 14px notwidthstanding
8411dff
to
f59408e
Compare
@hellofromtonya might you be able to help with this? |
@@ -452,6 +452,7 @@ function wp_get_computed_fluid_typography_value( $args = array() ) { | |||
* formula depending on available, valid values. | |||
* | |||
* @since 6.1.0 | |||
* @since 6.1.1 Adjusted min a |
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.
Looks like this is an incomplete update. @ramonjd could you adjust this?
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.
Sorry, just saw this. Thanks @desrosj
I see this PR has been merged. Should I open a new one to update the comment?
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.
Oh I see you updated it: https://github.com/ramonjd/wordpress-develop/blob/trunk/src/wp-includes/block-supports/typography.php#L455
Thank you very much!
Backporting changes in WordPress/gutenberg#45536
Trac ticket: https://core.trac.wordpress.org/ticket/57075
Updates to the fluid typography rules:
>16px
. This applies to custom values from the editor or single-value theme.json styles. Font sizes below this will not be clamped.fluid.min
value has been specified, the lower bound rule of>16px
won't be enforced on this value. Presets with a fluid object therefore, give precedence to theme author's values.fluid.max
but there isfluid.min
, use the incoming"size"
value as the max.fluid.min
but there is afluid.max
, usesize * min_size_factor
as the min. Here we do enforce the lower bound rule of>16px
, because Gutenberg is computing the min value. This is consistent with the way we calculate minimum sizes for single or custom values.Testing
Using theme 2023
Add some text blocks to the editor, apply presets and custom sizes, and ensure they appear as they should in the editor and frontend at various viewport widths.
The size value should act at the upper bound of any clamp value.
Custom font sizes <=14px will not be clamped.
Please test by playing around with: