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

List Item: Allow Gutenberg to override core block type #44911

Merged
merged 1 commit into from
Oct 17, 2022

Conversation

aaronrobertshaw
Copy link
Contributor

Related:

What?

Allows Gutenberg to reregister the core/list-item block on the PHP side.

Why?

Fixes some issues with the List Item block.

  • Without this we can't extend the List Item block fully in Gutenberg
  • Global Styles for the List Item block will not save

How?

  • Adds list-item to the list of block directories for the Gutenberg core block reregistration action

Testing Instructions

  1. Add font size block support to the List Item block.json (see below for snippet)
  2. On trunk (with WP 6.0), in the Site Editor, select a page that has a list containing the List Item block e.g. Navigation
  3. Navigate to Global Styles > Blocks > List Item > Typography
  4. Set the XL font size, this should be reflected in the preview.
  5. Save your Global Styles changes, the large font size will disappear
  6. Checkout this PR branch and reload the Site Editor
  7. Re-apply the XL font size and save again
  8. This time the styles will remain.
Alternate Testing Approach
  1. On a site running WP 6.1-RC1, checkout List Item: Adopt typography supports #43312
  2. In the Site Editor, navigate to Global Styles > Blocks and notice that List Item isn't in the list
    • This is because without the fix in this PR, Gutenberg doesn't override core's List Item block
    • Without that override, the List Item block never gets the block supports from #43312 and so doesn't show.
  3. Apply the fix in this PR, reload the Site Editor, and confirm you can now see List Item under Global Styles > Blocks and adjust typography settings.

@aaronrobertshaw aaronrobertshaw added [Type] Bug An existing feature does not function as intended [Block] List Affects the List Block labels Oct 13, 2022
@aaronrobertshaw aaronrobertshaw self-assigned this Oct 13, 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.

The change looks good to me. Thank you, @aaronrobertshaw!

Copy link
Contributor

@glendaviesnz glendaviesnz left a comment

Choose a reason for hiding this comment

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

Worked for me - fixed the issue with #43312 when this patch was applied there.

@aaronrobertshaw aaronrobertshaw merged commit 448ffa8 into trunk Oct 17, 2022
@aaronrobertshaw aaronrobertshaw deleted the add/list-item-to-block-overrides branch October 17, 2022 05:34
@github-actions github-actions bot added this to the Gutenberg 14.4 milestone Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants