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

When font size is turned off in theme.json, the typography panel does not completely hide the font size option. #59732

Closed
carolinan opened this issue Mar 10, 2024 · 4 comments
Labels
[Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

carolinan commented Mar 10, 2024

Description

Developers can use theme.json to enable font sizes site wide. They can also remove them for a single block by setting "customFontSize": false and leaving the fontSizes array empty: "fontSizes": [].

This removes the font size control from the global styles block typography panel: Site Editor > Styles Sidebar > Blocks > Block name > Typography;
But not from the Typography panel when an individual block is selected.

  1. The font size menu item is still visible, and selected, in the "Typography options" menu.
  2. The font size is the default visible control in the panel, and when it is turned off, the Typography panel is expanded but empty.
  3. A font size that is already set on a block, for example in a template or pattern, can be reset from the Typography options menu. I am not sure if this is intentional or a bug. - After the discussion about resetting the shadows, I was under the impression that only the global styles should be resettable if a feature is not supported.

Step-by-step reproduction instructions

Add the following to the settings section of theme.json:

		"blocks": {
			"core/heading": {
				"typography": {
					"fontSizes": [],
					"customFontSize": false
				}
			}
		}

Open the block editor or site editor and add a heading block.
Open the Typography panel in the block settings panel (the inspector). Check if the font size options are present.

Screenshots, screen recording, code snippet

In this image, the Typography panel is expanded by default, but empty:
The Typography panel with a partially removed font size option

Environment info

WordPress 6.4.3, 6.5 RC.

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

@carolinan carolinan added [Type] Bug An existing feature does not function as intended [Feature] Typography Font and typography-related issues and PRs labels Mar 10, 2024
@kraftner
Copy link

kraftner commented Apr 26, 2024

I just stumbled onto this. Just some additional observations:

There seem to be issues that are at least closely related: #50330 and #45273

Also this is a regression in WP 6.5 since I was able to completely disable all typography features before by having these settings in settings.typrography in theme.json:

"typography": {
	"fontSizes": [],
	"customFontSize": false,
	"defaultFontSizes": false,
	"writingMode": false,
	"dropCap": false,
	"textDecoration": false,
	"letterSpacing": false,
	"textTransform": false,
	"fontWeight": false,
	"fontStyle": false,
	"lineHeight": false
},

Another curious thing I noticed is that in 6.4 it works in the block editor when editing post content: The Typography panel is gone.
But when editing the globals styles it never goes away.

In 6.5 it stays in both cases.


I then looked through the codebase but wasn't really sure where to look. One issue that stood out was that at some point the panels for global styles and block styles got merged. Considering the difference in behavior described above I am guessing this could be related: #47356

@kraftner
Copy link

I investigated this further and what I noticed are basically two separate issues.

The issue above, which should already be fixed with https://github.com/WordPress/gutenberg/pull/58409/files#diff-def0802a58e1512057e07b22af00a628023b325ea4bdf28a87b322529405cdf2R54-R59

And what I described above is another issue tracked in #61231

@annezazu
Copy link
Contributor

Wanted to bring attention to the work done to Add defaultFontSizes theme.json and how that allows theme authors to disable showing the default font sizes and show only custom options: #58409 Does this resolve the concern or do you want an ability to completely remove any font size typography controls? Can't tell if I'm missing something here :)

@carolinan
Copy link
Contributor Author

I have retested, and this is indeed fixed in 6.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants