#61443 closed defect (bug) (fixed)
Prevent redundant block style variation CSS
Reported by: | aaronrobertshaw | Owned by: | oandregal |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | Editor | Keywords: | gutenberg-merge has-patch has-unit-tests |
Focuses: | Cc: |
Description
This ticket tracks the backporting of PHP files for the following Gutenberg fix:
https://github.com/WordPress/gutenberg/pull/62465
These changes prevent duplicate and redundant CSS being generated for block style variations.
Change History (9)
This ticket was mentioned in PR #6827 on WordPress/wordpress-develop by @aaronrobertshaw.
6 months ago
#1
- Keywords has-patch has-unit-tests added
@aaronrobertshaw commented on PR #6827:
6 months ago
#2
I noticed while creating this backport of https://github.com/WordPress/gutenberg/pull/62465 that there's a difference in signature between core and Gutenberg for get_block_nodes
.
Before this change:
Core: private static function get_block_nodes( $theme_json )
Gutenberg: private static function get_block_nodes( $theme_json, $selectors = array() )
I'll try and sort this out in time for beta 3.
@aaronrobertshaw commented on PR #6827:
6 months ago
#3
The PR modifying the function signature in Gutenberg was https://github.com/WordPress/gutenberg/pull/41217.
From https://github.com/WordPress/gutenberg/pull/41217#issuecomment-1354426105 it looks like it the fact the PR wasn't backported was already known however perhaps not that "everything will be fine" as suggested after https://github.com/WordPress/gutenberg/pull/46579.
As far as I can tell, I don't think there'll be any harm in updating get_block_nodes
function to match Gutenberg's version.
@aaronrobertshaw commented on PR #6827:
6 months ago
#4
I've made the required updates from https://github.com/WordPress/gutenberg/pull/41217.
Flagging this as ready for review once the Gutenberg PR lands.
@ramonopoly commented on PR #6827:
6 months ago
#5
This PR is testing well for me. For blocks with the block style variation applied, I'm seeing the following, related classnames in the class attribute in both the editor and frontend:
is-style-custom is-style-custom-b321ad1e-3e38-4a3c-af91-ef82f0c9855d
@aaronrobertshaw commented on PR #6827:
6 months ago
#6
I'm seeing the following, related classnames in the class attribute in both the editor and frontend
For the moment, this is expected. The is-style-custom
classname is what's applied by the editor and is hooked onto by the block support to generate the class specific to this instance or application of the block style, is-style-custom--<hash>
.
@isabel_brison commented on PR #6827:
6 months ago
#7
Just a quick note that applying this patch on top of the latest trunk (after the custom CSS fix) still shows everything working as expected 👍
#8
@
6 months ago
- Owner set to oandregal
- Resolution set to fixed
- Status changed from new to closed
In 58422:
@oandregal commented on PR #6827:
6 months ago
#9
Committed at https://core.trac.wordpress.org/changeset/58422
This PR backports the PHP updates from: https://github.com/WordPress/gutenberg/pull/62465
The changes prevent redundant or duplicate CSS being generated for block style variations.
### Test Instructions
/styles/partial.json
Custom
block style variation.is-style-custom-*
css class matchedTrac ticket: https://core.trac.wordpress.org/ticket/61443