diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 312ae5a75f182..325505ff60359 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -146,7 +146,7 @@ function gutenberg_get_layout_definitions() { ), ), array( - 'selector' => ' > *', + 'selector' => ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. 'rules' => array( 'margin' => '0', ), @@ -168,7 +168,7 @@ function gutenberg_get_layout_definitions() { 'displayMode' => 'grid', 'baseStyles' => array( array( - 'selector' => ' > *', + 'selector' => ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. 'rules' => array( 'margin' => '0', ), diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 446000eea257f..ac6dd17fc3a3d 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -1486,7 +1486,7 @@ protected function get_layout_styles( $block_metadata ) { $has_fallback_gap_support = ! $has_block_gap_support; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support. $node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() ); $layout_definitions = gutenberg_get_layout_definitions(); - $layout_selector_pattern = '/^[a-zA-Z0-9\-\.\ *+>:\(\)]*$/'; // Allow alphanumeric classnames, spaces, wildcard, sibling, child combinator and pseudo class selectors. + $layout_selector_pattern = '/^[a-zA-Z0-9\-\.\,\ *+>:\(\)]*$/'; // Allow alphanumeric classnames, spaces, wildcard, sibling, child combinator and pseudo class selectors. // Gap styles will only be output if the theme has block gap support, or supports a fallback gap. // Default layout gap styles will be skipped for themes that do not explicitly opt-in to blockGap with a `true` or `false` value. diff --git a/packages/block-editor/src/layouts/definitions.js b/packages/block-editor/src/layouts/definitions.js index e7b86fb1e80d1..a5c6d431c50f2 100644 --- a/packages/block-editor/src/layouts/definitions.js +++ b/packages/block-editor/src/layouts/definitions.js @@ -134,7 +134,7 @@ export const LAYOUT_DEFINITIONS = { }, }, { - selector: ' > *', + selector: ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0', }, @@ -156,7 +156,7 @@ export const LAYOUT_DEFINITIONS = { displayMode: 'grid', baseStyles: [ { - selector: ' > *', + selector: ' > :is(*, div)', // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: '0', },