wordpress-develop
wordpress-develop copied to clipboard
add support for __experimentalSkiSerialization to the shadow attribute
What? This is a backport of the merged Gutenberg PR https://github.com/WordPress/gutenberg/pull/59887 When a dynamic block defines __experimentalSkipSerialization in its block.supports.shadow the styles continue to be printed to the block wrapper element. This PR corrects that behavior so that shadow behaves like border, color, and others. Why? This provides the expected behavior for dynamic blocks that need to opt out of having the shadow styles printed to the block wrapper. How? Added a check at the start of the render function to return an empty array if the block has set __experimentalSkipSerialization
(This is my first attempt at submitting a Gutenberg PR to be included back into WP Core so welcome any advice if I'm doing this wrong)
Trac ticket: https://core.trac.wordpress.org/ticket/60784#ticket
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.
Core Committers: Use this line as a base for the props when committing in SVN:
Props colind, madhudollu, aaronrobertshaw, vcanales, isabel_brison.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.
Test using WordPress Playground
The changes in this pull request can previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.
Some things to be aware of
- The Plugin and Theme Directories cannot be accessed within Playground.
- All changes will be lost when closing a tab with a Playground instance.
- All changes will be lost when refreshing the page.
- A fresh instance is created each time the link below is clicked.
- Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.
@madhusudhand are you aware of any PRs in progress adding unit tests for the shadow support?
I have created https://github.com/WordPress/gutenberg/pull/60063 which tests these changes.
👋 @colinduwe @madhusudhand what is the status here?
It looks like https://github.com/WordPress/gutenberg/pull/60063 has been approved. Are you facing any blockers?
@vcanales I think it is probably only blocked by my ignorance of the process here. I thought this was merely awaiting approval from someone with commit access.
It looks like https://github.com/WordPress/gutenberg/pull/60063 has been approved. Are you facing any blockers?
Once https://github.com/WordPress/gutenberg/pull/60063 is merged, this should probably also include the unit test the code change relates to.
@colinduwe could you bring the unit tests from https://github.com/WordPress/gutenberg/pull/60063 into this?
@madhusudhand I think I'm out of my depth here. I'm not sure how to do that.
@colinduwe I have created #6613 with the unit tests. Please checkout #6613 to a branch and cherry pick the commit 8a4659608ba43363b4bd63fd76e99635c55141c8 into this PR
git fetch origin pull/6613/head:shadow-unit-tests
git cherry-pick 8a4659608ba43363b4bd63fd76e99635c55141c8
Your're a hero @madhusudhand. Thanks. Done.
Committed in r58312.