Skip to content

Background: Not possible to manually overwrite background gradients in the editor #73636

@hanneslsm

Description

@hanneslsm

Description

(Changed the original issue from "It's not possible to set gradients as backgrounds" (I was doing it wrong) to "it's not possible to manually overwrite gradient backgrounds with colors in the editor")

While there are many issues about background, background-image (e.g. #54336, #60401) et cetera, we're missing for theme creators an important feature: Set gradients and variables with gradients as backgrounds. Gradients that are set as background cannot be overwritten by the user in the editor.

I was running in this issue because I'm using section styles, each with a different gradient as the background.

@andrewserong @ramonjd CC'ing you since you were very active in the other background related issues

Step-by-step reproduction instructions

Original issue (I was doing it wrong, see Andrews first comment to point to the correct way)

1. Add a gradient to theme.json as the background of the page. Either directly or by using a variable like var:preset|gradient|redblue

...
	"styles": {
		"color": {
			"background": "linear-gradient(180deg, red 0%, blue 100%)",
			"text": "var:preset|color|contrast"
		}
           }
...

2. Open the website. No background, because it uses background-color

Image

  1. Create section styles with background gradients:
...
	"styles": {
		"color": {
			"background": "lime",
			"text": "var:preset|color|contrast"
			"gradient": "linear-gradient(red, blue)",
		}
           }
...
  1. Try to overwrite the background in the editor with a color.
    Image

Environment info

  • WP 6.8.3 & 6.9 RC3

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

  • Yes

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

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Package] Style Engine/packages/style-engine[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions