Skip to content

Editor crashes on typeset switch when fontFace array is not correctly defined #80480

Description

@hanneslsm

Description

When a typeset has a fontFace defined but it is missing the following info, the editor crashes when selecting this typeset.

		"fontFamily": "poppins, sans-serif",
		"name": "Poppins",
		"slug": "poppins"

Step-by-step reproduction instructions

  1. create a typeset with a ``fontface`
{
	"$schema": "https://schemas.wp.org/wp/7.0/theme.json",
	"version": 3,
	"title": "Poppins",
	"slug": "poppins",
	"settings": {
		"typography": {
			"fontFamilies": [
				{
					"fontFace": [
						{
							"fontFamily": "Poppins",
							"fontStyle": "normal",
							"fontWeight": "100",
							"src": [
								"file:./assets/fonts/poppins/poppins-100-normal.woff2"
							]
						}
					],
					"fontFamily": "poppins, sans-serif",
					"name": "Poppins",
					"slug": "poppins"
					}
			]
		}
	} 
}
  1. remove the fontFamily, name, and slug
  2. switch to the typeset

Screenshots, screen recording, code snippet

TypeError: Cannot read properties of undefined (reading 'replace')
    at Yl (https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:33)
    at https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:3135
    at Array.forEach (<anonymous>)
    at https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:3087
    at Array.forEach (<anonymous>)
    at https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:3064
    at Array.reduce (<anonymous>)
    at rhe (https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:2953)
    at https://with-lab.ddev.site/wp-includes/js/dist/editor.min.js?ver=425fffc30511d9d52e5f:31:9755
    at Array.forEach (<anonymous>)
Screen.Recording.2026-07-20.at.18.20.10.mov

Environment info

  • WP 7.0.2

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

Please confirm which theme type you used for testing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions