Repository navigation
Fluid typography: custom font-sizes should use max viewport width - #51516
Merged
ramonjd merged 3 commits intoJun 15, 2023
Merged
Conversation
- ensures that custom font size calculations take into account any layout.wideSize values - guards against unsupported units for min and max viewport widths in the backend - adds tests to cover changes
ramonjd
requested review from
andrewserong,
apeatling,
noisysocks and
tellthemachines
June 15, 2023 03:44
ramonjd
added a commit
to ramonjd/wordpress-develop
that referenced
this pull request
Jun 15, 2023
…ill cause PHP warnings and invalid clamp values. WordPress/gutenberg#51516
Member
Author
|
Added to backport WordPress/wordpress-develop#4604 |
|
Size Change: -81 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in d5f6321. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5274567262
|
andrewserong
approved these changes
Jun 15, 2023
andrewserong
left a comment
Contributor
There was a problem hiding this comment.
Nice fix! Just left a couple of very tiny nits, but this LGTM:
✅ Custom fluid typography is consistent between the editor and site frontend
✅ Any clamp() values in layout.wideSize causes the fluid rules to no longer apply
Thanks for all the fluid typography follow-ups! ✨
Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
Reinstate return break
ramonjd
enabled auto-merge (squash)
June 15, 2023 05:45
ramonjd
deleted the
update/custom-fluid-font-size-should-use-layout-widesize
branch
June 15, 2023 06:17
ramonjd
added a commit
that referenced
this pull request
Jun 20, 2023
ramonjd
added a commit
that referenced
this pull request
Jun 20, 2023
sethrubenstein
pushed a commit
to pewresearch/gutenberg
that referenced
this pull request
Jul 13, 2023
…rdPress#51516) * This commit: - ensures that custom font size calculations take into account any layout.wideSize values - guards against unsupported units for min and max viewport widths in the backend - adds tests to cover changes * Apply suggestions from code review Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Update typography-utils.js Reinstate return break --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
sethrubenstein
pushed a commit
to pewresearch/gutenberg
that referenced
this pull request
Jul 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR:
layout.wideSizevaluesKudos (again) to @WraithKenny for finding this
Why?
#51146 introduced the base behaviour but missed custom font size values
How?
Switching custom font size calculations in the editor to use
getTypographyFontSizeValue, which performs a check for global fluid font size support, andgetFluidTypographyOptionsFromSettingswhich ensures we're passing the right values, including the value oflayout.wideSize.Testing Instructions
In 2023, apply a custom font size to a text block in the editor (post or site).
Save the page. Check that the clamped value is the same in the frontend and backend.
Now update your theme.json with an invalid
layout.wideSizevalue. This value is used to calculate the clamp function's max width.{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": { "appearanceTools": true, "typography": { "fluid": true }, "layout": { "wideSize": "min(calc(100% - 60px), 1400px)" } } }Check that the clamped font size is not calculated. Changing
layout.wideSizeto a supported value + unit, e.g.,100remor1300pxshould enabled clamped values.