Skip to content

Hide the Font Size picker on Paragraph blocks when there is only one size defined #11628

Closed

Description

Is your feature request related to a problem? Please describe.
When the editor-font-sizes array has been limited to a single item, paragraphs only have one size. If custom font sizes are also disabled, the font size picker becomes a redundant control. See below screenshot:
image

Describe the solution you'd like
When custom font sizes are disabled, and only a single editor-font-size is set, the font size picker should not be displayed.

For instance, given the following code:

<?php
	add_theme_support( 'editor-font-sizes', array(
		array(
			'name' => __( 'Normal', 'gutenberg-test' ),
			'shortName' => __( 'N', 'gutenberg-test' ),
			'size' => 16,
			'slug' => 'normal'
		),
	) );
	add_theme_support('disable-custom-font-sizes');

I would expect to see the following:
image

Describe alternatives you've considered
This could potentially be solved on a case-by-case basis with some custom JS, or by creating a custom block. However, these are not particularly good solutions compared to a simple conditional statement in the original block definition.

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

Metadata

Assignees

No one assigned

    Labels

    Good First IssueAn issue that's suitable for someone looking to contribute for the first timeNeeds Technical FeedbackNeeds testing from a developer perspective.Needs TestingNeeds further testing to be confirmed.[Block] ParagraphAffects the Paragraph Block[Feature] UI ComponentsImpacts or related to the UI component system[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions