gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Responsive styles: When enabled and a font-size is setting, the corresponding CSS variable remains undefined.

Open s56bouya opened this issue 3 months ago • 3 comments

Description

As described in the title.

theme.json setting(settings.typography.fontSizes)

{
	"fluid": {
		"min": "1.8rem",
		"max": "2rem"
	},
	"name": "3XL",
	"slug": "3xl",
	"size": "2rem"
},

Defined CSS variables

--wp--preset--font-size--3-xl

Output CSS font-size property (tablet or mobile only styling)

font-size: var(--wp--preset--font-size--3xl) !important;

Step-by-step reproduction instructions

  1. Responsive styles ON
  2. Select [Style tablet only] or [Style mobile only]
  3. Create paragraph block
  4. Setting paragraph block FONT SIZE 3XL:(theme.json custom fontSizes)
  5. Preview in new tab

Screenshots, screen recording, code snippet

Image Image

Environment info

  • WP 7.1-RC4
  • Google Chrome 151.0.7922.138, Firefox 153.0.4

Please confirm that you have searched existing issues in the repo.

  • [x] Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • [x] Yes

Please confirm which theme type you used for testing.

  • [x] Block
  • [ ] Classic
  • [ ] Hybrid (e.g. classic with theme.json)
  • [ ] Not sure

s56bouya avatar Aug 18 '26 07:08 s56bouya

Thanks for the report.

Strictly speaking, similar problems have existed for a long time. See #53695.

Although issue #80583 resolved the fundamental problems, I believe we overlooked addressing responsive styling.

As a temporary workaround, you can add hyphens before and after the numbers in the preset slugs.

{
	"fluid": {
		"min": "1.8rem",
		"max": "2rem"
	},
	"name": "3XL",
	"slug": "3-xl",
	"size": "2rem"
},

cc @jorgefilipecosta @ramonjd @tellthemachines

t-hamano avatar Aug 18 '26 13:08 t-hamano

Thanks as always for showing me how to fix it!

s56bouya avatar Aug 18 '26 14:08 s56bouya

I added it to the 7.2 iteration

  • https://github.com/WordPress/gutenberg/issues/80388

Thanks for the report.

ramonjd avatar Aug 19 '26 00:08 ramonjd