Skip to content

Fluid typography: do not calculate fluid font size when min and max viewport widths are equal#5875

Closed
ramonjd wants to merge 4 commits intoWordPress:trunkfrom
ramonjd:fix/fluid-typography-viewport-denominator
Closed

Fluid typography: do not calculate fluid font size when min and max viewport widths are equal#5875
ramonjd wants to merge 4 commits intoWordPress:trunkfrom
ramonjd:fix/fluid-typography-viewport-denominator

Conversation

@ramonjd
Copy link
Copy Markdown
Member

@ramonjd ramonjd commented Jan 16, 2024

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.

…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.
@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@ramonjd
Copy link
Copy Markdown
Member Author

ramonjd commented Jan 16, 2024

Those failing PHP 8 multisite tests look unrelated to me.

@andrewserong
Copy link
Copy Markdown
Contributor

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?

@ramonjd ramonjd changed the title Fluid typography: provide fallback for linear scale where min and max viewport widths are equal Fluid typography: do not calculate fluid font size when min and max viewport widths are equal Jan 16, 2024
@ramonjd
Copy link
Copy Markdown
Member Author

ramonjd commented Jan 16, 2024

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.

🍺

@audrasjb
Copy link
Copy Markdown
Contributor

This looks good to me. I restarted the failed phpunit test.

@audrasjb
Copy link
Copy Markdown
Contributor

Unit tests are passing now.

Copy link
Copy Markdown
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, too, tested while reviewing WordPress/gutenberg#57866, and this is working nicely for me 👍

Copy link
Copy Markdown
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Code LGTM and works well in testing.

@tellthemachines
Copy link
Copy Markdown
Contributor

Committed in r57329.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants