Skip to content

Commit

Permalink
Slightest specificity bump to flex and grid margin overrides.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Apr 18, 2024
1 parent 61ae3b0 commit 4b5ea07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
Expand All @@ -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',
),
Expand Down
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/layouts/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand All @@ -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',
},
Expand Down

0 comments on commit 4b5ea07

Please sign in to comment.