Opened 8 weeks ago
Closed 7 weeks ago
#65641 closed defect (bug) (maybelater)
Custom CSS: Fix cascade order against block style variations
| Reported by: | ramonopoly | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | gutenberg-merge has-patch has-unit-tests |
| Cc: | Focuses: |
Description
Trac ticket to backport the Gutenberg PR: https://github.com/WordPress/gutenberg/pull/80340
The Gutenberg PR makes per-block custom CSS reliably win over block style variation (section style) styles, and makes the editor cascade match the front end.
Addresses two of the reports in https://github.com/WordPress/gutenberg/issues/80057 (custom CSS being overridden by block styles, and the editor/front-end mismatch).
The bug:
Style variation styles were overriding custom CSS due to the order in which they are printed.
Both rulesets are wrapped in :root :where() and print at 0-1-0 specificity, so whichever prints later wins.
Change History (4)
This ticket was mentioned in PR #12551 on WordPress/wordpress-develop by @ramonopoly.
8 weeks ago
#1
- Keywords has-patch has-unit-tests added
@ramonopoly commented on PR #12551:
7 weeks ago
#2
I'm not sure about this one, at least the front end fix. I think I'm going after the symptom and not the virus 😄. I think maybe custom CSS needs special handling not variations. Not sure
@ramonopoly commented on PR #12551:
7 weeks ago
#3
Closing this as not needed right now.
https://github.com/WordPress/gutenberg/pull/80340#issuecomment-4998205351
#4
@
7 weeks ago
- Milestone Awaiting Review
- Resolution → maybelater
- Status new → closed
Closing as a mix between won't fix (nothing ostensibly broken in the output) and needs more input/thinking.
https://github.com/WordPress/gutenberg/pull/80340#issuecomment-4998205351
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
## Trac ticket
https://core.trac.wordpress.org/ticket/65641
## Description
Backport of WordPress/gutenberg#80340.
Makes per-block custom CSS reliably win over block style variation (section style) styles on the front end. Both rulesets are wrapped in
:root :where()and print at 0-1-0 specificity, so whichever prints later wins. That order was accidental: it fell out of enqueue order between thewp-block-custom-cssandblock-style-variation-styleshandles.### Changes
wp-block-custom-cssnow declaresblock-style-variation-stylesas a dependency, so custom CSS always prints after variation styles.### Testing
background-color: blue;.---
This is a PHP-only backport. The editor-side JS changes (cascade ordering of overrides and
clientIdthreading) from the Gutenberg PR are not included — they ship via the Gutenberg plugin.Props andrewserong, ramonopoly.
Fixes #65641.