Skip to content

Commit

Permalink
Layout: Fix issue with fallback gap styles where gap was being output…
Browse files Browse the repository at this point in the history
… for constrained layout type (#44001)
  • Loading branch information
andrewserong authored Sep 9, 2022
1 parent af73244 commit a598eb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -1358,8 +1358,8 @@ protected function get_layout_styles( $block_metadata ) {
// If the block should have custom gap, add the gap styles.
if ( null !== $block_gap_value && false !== $block_gap_value && '' !== $block_gap_value ) {
foreach ( $layout_definitions as $layout_definition_key => $layout_definition ) {
// Allow skipping default layout for themes that opt-in to block styles, but opt-out of blockGap.
if ( ! $has_block_gap_support && 'default' === $layout_definition_key ) {
// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
if ( ! $has_block_gap_support && 'flex' !== $layout_definition_key ) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ export function getLayoutStyles( {
if ( gapValue && tree?.settings?.layout?.definitions ) {
Object.values( tree.settings.layout.definitions ).forEach(
( { className, name, spacingStyles } ) => {
// Allow skipping default layout for themes that opt-in to block styles, but opt-out of blockGap.
if ( ! hasBlockGapSupport && 'default' === name ) {
// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
if ( ! hasBlockGapSupport && 'flex' !== name ) {
return;
}

Expand Down

0 comments on commit a598eb4

Please sign in to comment.