Skip to content

Commit

Permalink
Fix navigation block off-canvas appender for empty menus (#48907)
Browse files Browse the repository at this point in the history
- Pass the parent client id in as a prop instead of trying to determine the id from inner blocks
  • Loading branch information
talldan authored and Mamaduka committed Mar 9, 2023
1 parent 3082500 commit 9410fd7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Appender = forwardRef(
ref={ ref }
rootClientId={ clientId }
position="bottom right"
isAppender={ true }
isAppender
selectBlockOnInsert={ false }
shouldDirectInsert={ false }
__experimentalIsQuick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
*
* @param {Object} props Components props.
* @param {string} props.id An HTML element id for the root element of ListView.
* @param {string} props.parentClientId The client id of the parent block.
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {boolean} props.showBlockMovers Flag to enable block movers
* @param {boolean} props.isExpanded Flag to determine whether nested levels are expanded by default.
Expand All @@ -68,6 +69,7 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
function OffCanvasEditor(
{
id,
parentClientId,
blocks,
showBlockMovers = false,
isExpanded = false,
Expand Down Expand Up @@ -229,6 +231,7 @@ function OffCanvasEditor(
>
<ListViewContext.Provider value={ contextValue }>
<ListViewBranch
parentId={ parentClientId }
blocks={ clientIdsTree }
selectBlock={ selectEditorBlock }
showBlockMovers={ showBlockMovers }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const MainContent = ( {
return (
<OffCanvasEditor
blocks={ clientIdsTree }
parentClientId={ clientId }
isExpanded={ true }
LeafMoreMenu={ LeafMoreMenu }
description={ description }
Expand Down

0 comments on commit 9410fd7

Please sign in to comment.