Skip to content

Setting background color on block changes custom gradient attribute  #53941

@andreaslindahl

Description

@andreaslindahl

Description

Starting in WP 6.3 I'm experiencing a bug related to block background color and attributes in my block.

I have a custom block with an attribute named "gradient" (boolean). Supports for the block are configured as follows:

"color": {
	"background": true,
	"text": true
}	

If the gradient attribute for my block is set to true, it is automatically set to false when a background color is selected in the editor. This used to work fine in previous versions of Wordpress. My guess is that my custom gradient attribute conflicts with an internal Gutenberg attribute applied to blocks also named gradient.

My gradient attribute is not related to the selected background color in any way, so having Gutenberg automatically change it is not exactly good in my case...

First of all, is there a way to fix this without migrating all of my blocks to use another attribute name for my gradient setting?

And is there a list of reserved attribute names used by Gutenberg to avoid future conflicts with other attribute names?

Step-by-step reproduction instructions

Create a custom block with a boolean attribute named gradient.
Add support for background color in the block.json file.
In the editor, make sure that the gradient attribute is set to true
Select a background color
The gradient attribute is set to false

Screenshots, screen recording, code snippet

No response

Environment info

Wordpress 6.3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] ColorsColor management[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions