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

FontFamily: Fix server-side attribute registration via typography support #43937

Merged

Conversation

aaronrobertshaw
Copy link
Contributor

Related:

What?

Ensures the fontFamily attribute is registered for block types on the server side as well. This fixes a 400 error when attempting to change the font family for a server-side rendered block in the editor e.g. Archives, Tag Cloud etc.

Why?

The attribute registration should be there in the server-side typography block supports as per fontSize etc. Fixing this error also unlocks typography support adoption for server-side rendered blocks.

How?

Adds fontFamily to the block type's attributes when the block has font family support.

Testing Instructions

  1. Add typography support to a server-side rendered block e.g. Archives. (see block.json snippet below)
  2. Within the editor, add the block you adopted typography support for e.g Archives
  3. Within the inspector controls sidebar, switch to a new font
  4. Note the 400 error in the dev tools console
  5. Checkout this PR and repeat the process
  6. The font family should successfully change without any error
		"typography": {
			"__experimentalFontFamily": true
		}

Screenshots or screencast

Before After
Screen.Recording.2022-09-07.at.5.59.50.pm.mp4
Screen.Recording.2022-09-07.at.6.00.33.pm.mp4

@aaronrobertshaw aaronrobertshaw added [Type] Bug An existing feature does not function as intended [Block] Archives Affects the Archives Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Typography Font and typography-related issues and PRs labels Sep 7, 2022
@aaronrobertshaw aaronrobertshaw self-assigned this Sep 7, 2022
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works like a charm ✅ No more 400 error when applying this patch.

@aaronrobertshaw aaronrobertshaw merged commit d605cd4 into trunk Sep 7, 2022
@aaronrobertshaw aaronrobertshaw deleted the fix/font-family-attribute-for-server-side-render branch September 7, 2022 08:55
@github-actions github-actions bot added this to the Gutenberg 14.1 milestone Sep 7, 2022
@t-hamano
Copy link
Contributor

@aaronrobertshaw
A ticket related to this issue awas reported in WordPress core:
https://core.trac.wordpress.org/ticket/56678

Should this PR be backported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Archives Affects the Archives Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants