Fluid typography: do not calculate fluid font size when min and max viewport widths are equal#5875
Conversation
…e fluid typography config, set the linear scale factor to default `1`. To avoid dividing by zero values. PHP will throw an error and, besides, the fluid typography clamp rule needs valid max and min viewport constraints.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Those failing PHP 8 multisite tests look unrelated to me. |
|
Just adding a similar comment as to the one I left on WordPress/gutenberg#57866 (review), but I'm wondering if it'd be better to switch off fluid typography / return early if the min and max viewport sizes are the same? |
Thanks @andrewserong I agree and I've updated accordingly. The fluid typography clamp rule needs valid max and min viewport constraints to be "fluid" anyway, so returning early makes total sense. 🍺 |
|
This looks good to me. I restarted the failed phpunit test. |
|
Unit tests are passing now. |
andrewserong
left a comment
There was a problem hiding this comment.
LGTM, too, tested while reviewing WordPress/gutenberg#57866, and this is working nicely for me 👍
tellthemachines
left a comment
There was a problem hiding this comment.
Thanks for the PR! Code LGTM and works well in testing.
|
Committed in r57329. |
Syncs:
When the same value is provided for min and max viewport widths in the fluid typography config, return early.
The consequence is that fluid font sizes will not be calculated.
To avoid dividing by zero values. PHP will throw an error and, besides, the fluid typography clamp rule needs valid max and min viewport constraints.
Testing
See WordPress/gutenberg#57866 for testing instructions.
Trac ticket: https://core.trac.wordpress.org/ticket/60263
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.