-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: custom font sizes should be converted to fluid font sizes values #44758
Comments
@scruffian could you/themes folks spare any time to test the ongoing bugfix PRs for this issue? 🙇 cc/ @priethor |
Definitely a bug, otherwise the boolean would be unnecessary. Thank you for working on this. 🙏 |
💯 This is a bug indeed and a good way to summarize it. Thanks for addressing this! As a matter of fact, this is a very important bug to fix, considering fluid typography is among the top highlighted features in WP 6.1. The individual PRs are already approved and ready to merge & backport, so I'm flagging them to Editor Tech Leads @michalczaplinski, @ockham, @c4rl0sbr4v0, and Core Tech Leads @getsource, @jeffpaul, @dream-encode, for awareness and last-minute reviews before merging. |
Thanks @andrewserong I'm testing #44847 right now. I think we could add those changes as well if it's not going to blow up your day. I'll help as well. |
Closing this issue now that everything is merged and committed. Thanks everyone 🍺 |
I've added a tracking issue to consolidate all the work on fluid typography so far and to track ongoing enhancements: |
Gutenberg Bugfix PRs
wp/6.1 Gutenberg backport PR
Core Backport PRs
Description
In Gutenberg 13.8 Fluid Typography for font size presets was introduced:
This allows themers to generate fluid font size presets in theme.json, which can then be applied to other elements in theme.json or via the FontSizePicker in the editor.
However for fluid font sizes to be considered a complete feature, when
"settings.typography.fluid"
is set totrue
, custom font sizes should also be automatically converted to fluid values.This applies both to font size values set:
"styles"
, including blocks and elements, in theme.json (should also be fixed by Fluid Typography: Fix bug in global styles where fluid clamp rules were not calculated for custom values #44761)At present, with fluid typography enabled, font size values set by the user or otherwise are not fluid, and are applied to the target elements exactly as they are represented in the value fields.
For that reason it should be considered a "Bug".
Implementation
The functions to generate clamp values from static font size values are available since #39529
The follow high-level tasks probably need addressing:
gutenberg_get_typography_font_size_value
(PHP)-In the editor (JS), ensure that block style attribute
style.typography.fontSize
is converted and applied correctly to the block's inline styles usinggetTypographyFontSizeValue
. The value represented in the control field is to be decided: either the raw value or some indication that it is "fluid". Add responsive font sizes #33543 may provide some clues.Step-by-step reproduction instructions
Enable fluid font sizes in your theme.json.
Here is a sample theme.json
In the post or site editor, apply a preset font size to a text element.
Observe that the text reacts in size to changes to the view port, that is, that it is "fluid".
For the same element, apply a custom font size. The element now has the static custom font size value and it is not fluid.
This is true for both the editor and the frontend.
Screenshots, screen recording, code snippet
2022-10-07.09.14.14.mp4
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: