From 0f33c9e3e1abbdf1c1dce7b4f6da78879925cdfc Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 12 Feb 2024 18:21:15 +1100 Subject: [PATCH] Fix Spacer orientation when inside a block with default flex layout. (#58921) Co-authored-by: tellthemachines Co-authored-by: andrewserong Co-authored-by: t-hamano Co-authored-by: draganescu --- packages/block-library/src/spacer/edit.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/spacer/edit.js b/packages/block-library/src/spacer/edit.js index 11133732042d3f..d384f7997ec388 100644 --- a/packages/block-library/src/spacer/edit.js +++ b/packages/block-library/src/spacer/edit.js @@ -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 =