#58462 closed defect (bug) (fixed)
Ignore unregistered style variations declared via `theme.json`
| Reported by: | oandregal | Owned by: | oandregal |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.3 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
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.jsondataset. - 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
@
3 years ago
- Keywords needs-patch added
- Milestone Awaiting Review → 6.3
- Owner set to
- Status new → assigned
This ticket was mentioned in PR #4554 on WordPress/wordpress-develop by @oandregal.
3 years ago
#2
- Keywords has-patch has-unit-tests added; needs-patch removed
@oandregal commented on PR #4554:
3 years 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:
3 years ago
#5
Commited at https://core.trac.wordpress.org/changeset/55912
#6
@
3 years ago
- Resolution fixed
- Status closed → 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.
3 years ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/58462
@oandregal commented on PR #4615:
3 years ago
#9
Thanks! Commited at https://core.trac.wordpress.org/changeset/55915
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.jsondataset.## 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_DEBUGto true.theme.jsonof 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).