Skip to content

Global Styles: unable to save block variations when KSES is active #53428

@dsas

Description

@dsas

Description

The KSES filters prevent changing block variation styles via the Global Styles sidebar in the site editor.

These filters are only registered when a user doesn't have the unfiltered_html capability (which is the case for multisite regular admins).

When these filters are active, any change to the block variation property is reverted back to its previous value.

Looking at the HTTP request to the global-styles endpoint, the PUT request includes the block variation changes but the response doesn't.

Step-by-step reproduction instructions

  1. Activate latest Gutenberg on a multisite install, or test with a user not having the unfiltered_html capability, or enable the KSES filters with add_action( 'init', 'kses_init_filters' );
  2. Go to Appearance > Editor
  3. Open the Styles sidebar
  4. Select "Blocks"
  5. Select "Button"
  6. Select the Outline style variation
  7. Change a property away from the initial setting, e.g. set the background
  8. Save the changes
  9. ⚠️ Note how the changes are reverted

Screenshots, screen recording, code snippet

Screen.Recording.2023-08-08.at.15.26.58.mov

Environment info

GB plugin trunk

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

Metadata

Metadata

Assignees

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[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