From 5a59dbed82abebae4b842eb5cff765896ad7dbab Mon Sep 17 00:00:00 2001 From: Isabel Brison Date: Tue, 30 Jan 2024 23:49:09 +0000 Subject: [PATCH] Editor: reduce specificity of block style variation selector. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/wp-includes/class-wp-theme-json.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index f73781b2b3181..8a06d81d47242 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -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; }