-
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
Media & Text block shouldn't default to large font size - especially when font sizes are disabled #21126
Comments
I was able to reproduce this. The cause seems to be that the fontSize is hardcoded in the block template: gutenberg/packages/block-library/src/media-text/edit.js Lines 38 to 46 in ef799f6
I think either the template should have a sprinkling of magic so that it can detect when the theme disables font sizes, or the font size system should be smart enough not to apply the class. |
UX note: because this is a paragraph block, you can't quickly transform to a paragraph (bc it's already a p) from what may appear to be a heading block, end users can be confused. +1 to remove |
Using @smerriman's code of add_theme_support('disable-custom-font-sizes');
add_theme_support('editor-font-sizes', []); in your functions.php (or wherever makes sense) in combination with your style-editor.css file: .editor-styles-wrapper .has-small-font-size,
.editor-styles-wrapper .has-normal-font-size,
.editor-styles-wrapper .has-medium-font-size,
.editor-styles-wrapper .has-large-font-size,
.editor-styles-wrapper .has-huge-font-size {
font-size: initial !important;
} Does work as a temporary work-around on this issue. I think it would be preferable more eloquently override/change/disable default settings for a single component as this is a "brute-force" approach that modifies all Gutenberg components that normally support typography size selections. |
Trac #53366 has another request to use the "default" font size for these paragraphs. |
Could it be as simple as removing the one line from gutenberg/packages/block-library/src/media-text/edit.js? |
How is this still an issue? It is ridiculous that Gutenberg is riddled with issues like this where settings are simply applied to blocks and elements that cannot be properly managed or removed without hacks to the system. Please start fixing bugs like this and properly documenting how to manage settings via the theme.json. |
Walked into this bug today. Media-text has for me always been a weird block. It appears nice to have, but it pretty much isn't anymore with all the flex-controls we have in the columns block. To be fair, this block is becoming fairly redundant since we can build the same with a column or pattern (or reusable block for all I care). The 'crop fill to column' for the image is nice but it's not entirely needed. I can see reasons in above why this fix is ignored, because it may be on track to become removed / replaced possibly? |
This was fixed in #40329. |
Using a theme that contains:
add_theme_support('disable-custom-font-sizes'); add_theme_support('editor-font-sizes',array());
When a Media & Text block is added, the default paragraph for the content has a
has-large-font-size
class. While it doesn't appear large in the backend, it still appears large in the frontend.It's possible that the above code should remove the default styling of has-large-font-size from the frontend like it does in the backend - but regardless of that, the class shouldn't be added to the paragraph tag.
Desktop (please complete the following information):
WordPress 5.3.2.
The text was updated successfully, but these errors were encountered: