#60784 closed enhancement (fixed)
Add __experimentalSkipSerialization support to shadow
Reported by: | ColinD | Owned by: | isabel_brison |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
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 of 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)
Change History (18)
This ticket was mentioned in PR #6279 on WordPress/wordpress-develop by @ColinD.
9 months ago
#1
- Keywords has-patch added
#2
@
9 months ago
- Type changed from defect (bug) to enhancement
- Version trunk deleted
I thought we didn‘t want experimental APIs in core? See https://make.wordpress.org/core/2023/04/17/experimental-apis-in-wordpress-core-have-largely-been-tamed/
#3
@
9 months ago
The wp_should_skip_block_supports_serialization() function is already in core and is used by other block supports features like border and color. This merely brings parity to shadow so core Guteberg dynamic block https://github.com/WordPress/gutenberg/pull/59616 as well as extenders' dynamic blocks can opt out of shadow style serialization.
#4
@
9 months ago
This API (experimentalSkipSerialization) predates the experimental APIs discussion and is already in Core for other block supports. That said, we should probably stabilize this for all the block supports (and ensure the experimental flag still works but is deprecated). That said, it's probably independent work from the current ticket.
@madhudollu commented on PR #6279:
9 months ago
#5
@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.
@vcanales commented on PR #6279:
7 months ago
#6
👋 @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?
7 months ago
#7
@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.
@aaronrobertshaw commented on PR #6279:
7 months ago
#8
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.
@madhudollu commented on PR #6279:
7 months ago
#9
@colinduwe could you bring the unit tests from https://github.com/WordPress/gutenberg/pull/60063 into this?
This ticket was mentioned in PR #6613 on WordPress/wordpress-develop by @madhudollu.
7 months ago
#11
- Keywords has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/60784
This pull request is a sub set of https://github.com/WordPress/wordpress-develop/pull/6279 and these changes are to be merged with it.
@madhudollu commented on PR #6279:
7 months ago
#12
#15
@
6 months ago
- Owner set to isabel_brison
- Resolution set to fixed
- Status changed from new to closed
In 58312:
@isabel_brison commented on PR #6279:
6 months ago
#16
Committed in r58312.
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