Skip to content

Commit

Permalink
Fix Spacer orientation when inside a block with default flex layout. (#…
Browse files Browse the repository at this point in the history
…58921)

Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
  • Loading branch information
5 people authored and youknowriad committed Feb 13, 2024
1 parent 8a16821 commit 781dc3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/block-library/src/spacer/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,14 @@ const SpacerEdit = ( {
return editorSettings?.disableCustomSpacingSizes;
} );
const { orientation } = context;
const { orientation: parentOrientation, type } = parentLayout || {};
const {
orientation: parentOrientation,
type,
default: { type: defaultType } = {},
} = parentLayout || {};
// Check if the spacer is inside a flex container.
const isFlexLayout = type === 'flex';
const isFlexLayout =
type === 'flex' || ( ! type && defaultType === 'flex' );
// If the spacer is inside a flex container, it should either inherit the orientation
// of the parent or use the flex default orientation.
const inheritedOrientation =
Expand Down

0 comments on commit 781dc3b

Please sign in to comment.