#58462 closed defect (bug) (fixed)
Ignore unregistered style variations declared via `theme.json`
Reported by: | oandregal | Owned by: | oandregal |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Unregistered block style variations declared via theme.json
are considered to be valid. As a result,
- The site editor does not load when one is found in a
theme.json
dataset. - The global styles stylesheet (front-end) contains a CSS rule that doesn't have a selector.
Proposed solution
Make sure style variations processed from theme.json
are registered and ignore the ones that are not.
Change History (9)
#1
@
19 months ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 6.3
- Owner set to oandregal
- Status changed from new to assigned
This ticket was mentioned in PR #4554 on WordPress/wordpress-develop by @oandregal.
19 months ago
#2
- Keywords has-patch has-unit-tests added; needs-patch removed
@oandregal commented on PR #4554:
18 months ago
#3
@tellthemachines would you be able to test the site editor again and report back? It works fine for me.
@oandregal commented on PR #4554:
18 months ago
#5
Commited at https://core.trac.wordpress.org/changeset/55912
#6
@
18 months ago
- Resolution fixed deleted
- Status changed from closed to reopened
Hi @oandregal, The @since
is missing for new variable for the function and the indentation.
This ticket was mentioned in PR #4615 on WordPress/wordpress-develop by @mukesh27.
18 months ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/58462
@oandregal commented on PR #4615:
18 months ago
#9
Thanks! Commited at https://core.trac.wordpress.org/changeset/55915
Trac ticket https://core.trac.wordpress.org/ticket/58462#comment:1
Backports https://github.com/WordPress/gutenberg/pull/49807
## What?
This PR makes sure unregistered block style variations are ignored before processing any data coming from
theme.json
.## Why?
theme.json
dataset.## How?
By making sure the style variation is not added to the allowed list, unless it's registered for that particular block.
## Testing Instructions
WP_DEBUG
to true.theme.json
of TwentyTwentyThree:{{{json
{
}
}}}
The expected result is that:
{ background-color: red; color: blue}
(note the lack of CSS selector).class-wp-theme-json-gutenberg.php
. Intrunk
, you'll see something like this:Verify that upon updating the colors of the style variation via the global styles sidebar (blocks > quote > style variation plain), the user-provided colors are rendered everywhere (front & editors).