Skip to content

Commit

Permalink
Editor: reduce specificity of block style variation selector.
Browse files Browse the repository at this point in the history
Removes duplicate classname from the block style variation selector generated in `WP_Theme_JSON`’s `get_blocks_metadata` function.

Props flixos90, joemcgill, mukesh27, isabel_brison.
Fixes #60312.


git-svn-id: https://develop.svn.wordpress.org/trunk@57490 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
tellthemachines committed Jan 30, 2024
1 parent 0b800d7 commit 5a59dbe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,7 @@ protected static function get_blocks_metadata() {
if ( ! empty( $block_type->styles ) ) {
$style_selectors = array();
foreach ( $block_type->styles as $style ) {
// The style variation classname is duplicated in the selector to ensure that it overrides core block styles.
$style_selectors[ $style['name'] ] = static::append_to_selector( '.is-style-' . $style['name'] . '.is-style-' . $style['name'], static::$blocks_metadata[ $block_name ]['selector'] );
$style_selectors[ $style['name'] ] = static::append_to_selector( '.is-style-' . $style['name'], static::$blocks_metadata[ $block_name ]['selector'] );
}
static::$blocks_metadata[ $block_name ]['styleVariations'] = $style_selectors;
}
Expand Down

0 comments on commit 5a59dbe

Please sign in to comment.