Skip to content

Font size abbreviations in FontSizePicker are misleading when the theme declares multiple "small" sizes. #44245

@ZebulanStanphill

Description

@ZebulanStanphill

Description

The FontSizePicker control currently applies abbreviated "t-shirt" labels for the options based solely on their order. This means that the control assumes that the font sizes will start with "small", followed by "medium", "large", "very large", and so on.

The problem is that in practice, a theme may actually have two (or perhaps even three" sizes smaller than the default. I actually ran into this recently while trying to create a custom block theme for someone. When using the controls, the option labeled "M" is actually the "small" size, while "S" is the "extra small" size.

Obviously, this is quite confusing.

In prior versions of the editor, the abbreviated labels were merely sequential numbers. So in some sense, the latest versions have introduced a regression here.

Step-by-step reproduction instructions

  1. Use a block theme with a theme.json that has appearanceTools set to true and the following settings.typography.fontSizes set similar to this:
"fontSizes": [
	{
		"fluid": false,
		"name": "Extra small",
		"size": "0.75rem",
		"slug": "x-small"
	},
	{
		"fluid": false,
		"size": "0.875rem",
		"slug": "small"
	},
	{
		"fluid": false,
		"size": "1rem",
		"slug": "medium"
	},
	{
		"fluid": {
			"min": "1.125rem",
			"max": "1.25rem"
		},
		"size": "1.125rem",
		"slug": "large"
	},
	{
		"size": "1.5rem",
		"slug": "x-large"
	}
]
  1. Open Global Styles and hover over the font size presets in Typography -> Text.

Screenshots, screen recording, code snippet

image

Environment info

  • WordPress 6.0.2
  • Gutenberg 14.1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Feature] TypographyFont and typography-related issues and PRs[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions