Skip to content
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

Closed
smerriman opened this issue Mar 24, 2020 · 8 comments
Labels
[Block] Media & Text Affects the Media & Text Block [Type] Bug An existing feature does not function as intended

Comments

@smerriman
Copy link

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):

  • OS: Windows 7 (but applies to all)
  • Browser: Firefox (but applies to all)

WordPress 5.3.2.

@talldan talldan added [Block] Media & Text Affects the Media & Text Block Needs Testing Needs further testing to be confirmed. labels Mar 25, 2020
@talldan talldan added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Aug 4, 2020
@talldan
Copy link
Contributor

talldan commented Aug 4, 2020

I was able to reproduce this. The cause seems to be that the fontSize is hardcoded in the block template:

const TEMPLATE = [
[
'core/paragraph',
{
fontSize: 'large',
placeholder: _x( 'Content…', 'content placeholder' ),
},
],
];

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.

@JoshuaDoshua
Copy link
Contributor

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 fontSize from the template

@fembuelita
Copy link

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.

@sabernhardt
Copy link
Contributor

Trac #53366 has another request to use the "default" font size for these paragraphs.

@sabernhardt
Copy link
Contributor

Could it be as simple as removing the one line from gutenberg/packages/block-library/src/media-text/edit.js?

@ekazda
Copy link

ekazda commented Feb 11, 2022

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.

@Humanify-nl
Copy link

Humanify-nl commented Mar 10, 2022

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?

@carolinan
Copy link
Contributor

This was fixed in #40329.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Media & Text Affects the Media & Text Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

8 participants