WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#52709 closed defect (bug) (fixed)

get_block_wrapper_attributes checks for outdated __experimentalColor support

Reported by: noisysocks Owned by: noisysocks
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch commit dev-reviewed
Focuses: Cc:

Description

Copied from https://github.com/WordPress/gutenberg/issues/27670.

Describe the bug
Serverside rendered blocks with support for colors do not generate the appropriate classes if colors are set.

To reproduce
Steps to reproduce the behavior:

  1. Create any block with server side rendering, add support for color in its metadata.
  2. Use get_block_wrapper_attributes in the render callback.
  3. Check generated classes/styles

Expected behavior
Appropriate classes/styles should be generated.

Reason
wp_apply_colors_support checks for __experimentalColor instead of color when determining block support for color. See here: https://github.com/WordPress/WordPress/blob/master/wp-includes/block-supports/colors.php#L66
The classes get generated correctly if I add the __experimentalColor flag additonally in my block.json file.

"supports": {
  "color": true
}

Above does not work, below works.

"supports": {
  "color": true,
  "__experimentalColor": true
}

Editor version (please complete the following information):

  • WordPress version: 5.6
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? "default"
  • If the Gutenberg plugin is installed, which version is it? [e.g., 7.6]

Change History (7)

#2 @noisysocks
5 months ago

  • Keywords commit dev-feedback added

#3 @noisysocks
5 months ago

  • Keywords dev-reviewed added; dev-feedback removed

I'll commit this since I and @youknowriad have reviewed it.

#4 @prbot
5 months ago

noisysocks commented on PR #1068:

Thanks @nosolosw!

#5 @noisysocks
5 months ago

In 50488:

Block Editor: Fix color support for dynamic blocks

Changes wp_apply_colors_support to check for for color instead of
experimentalColor when determining block support for color.

Props nosolosw, rafhun, youknowriad.
See #52709.

#6 @noisysocks
5 months ago

In 50489:

Block Editor: Fix color support for dynamic blocks

Changes wp_apply_colors_support to check for for color instead of
experimentalColor when determining block support for color.

Props nosolosw, rafhun, youknowriad.
See #52709.

#7 @noisysocks
5 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.