diff --git a/packages/block-editor/src/components/off-canvas-editor/block.js b/packages/block-editor/src/components/off-canvas-editor/block.js
index 4d5e2e7ea8c49..e338c4c35c957 100644
--- a/packages/block-editor/src/components/off-canvas-editor/block.js
+++ b/packages/block-editor/src/components/off-canvas-editor/block.js
@@ -54,6 +54,7 @@ function ListViewBlock( {
isExpanded,
selectedClientIds,
preventAnnouncement,
+ selectBlockInCanvas,
} ) {
const cellRef = useRef( null );
const [ isHovered, setIsHovered ] = useState( false );
@@ -245,7 +246,13 @@ function ListViewBlock( {
{
+ event.preventDefault();
+ }
+ }
onToggleExpanded={ toggleExpanded }
isSelected={ isSelected }
position={ position }
diff --git a/packages/block-editor/src/components/off-canvas-editor/branch.js b/packages/block-editor/src/components/off-canvas-editor/branch.js
index 0c2b541f3199a..e752bcbc6cae5 100644
--- a/packages/block-editor/src/components/off-canvas-editor/branch.js
+++ b/packages/block-editor/src/components/off-canvas-editor/branch.js
@@ -4,9 +4,6 @@
import { memo } from '@wordpress/element';
import { AsyncModeProvider, useSelect } from '@wordpress/data';
-/**
- * Internal dependencies
- */
/**
* Internal dependencies
*/
@@ -92,6 +89,7 @@ function ListViewBranch( props ) {
isExpanded,
parentId,
shouldShowInnerBlocks = true,
+ selectBlockInCanvas,
} = props;
const isContentLocked = useSelect(
@@ -174,6 +172,7 @@ function ListViewBranch( props ) {
isExpanded={ shouldExpand }
listPosition={ nextPosition }
selectedClientIds={ selectedClientIds }
+ selectBlockInCanvas={ selectBlockInCanvas }
/>
) }
{ ! showBlock && (
@@ -194,6 +193,7 @@ function ListViewBranch( props ) {
isBranchSelected={ isSelectedBranch }
selectedClientIds={ selectedClientIds }
isExpanded={ isExpanded }
+ selectBlockInCanvas={ selectBlockInCanvas }
/>
) }
diff --git a/packages/block-editor/src/components/off-canvas-editor/index.js b/packages/block-editor/src/components/off-canvas-editor/index.js
index df48b8b0046ad..dd88b9ec43cc9 100644
--- a/packages/block-editor/src/components/off-canvas-editor/index.js
+++ b/packages/block-editor/src/components/off-canvas-editor/index.js
@@ -50,15 +50,22 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
/**
* Show a hierarchical list of blocks.
*
- * @param {Object} props Components props.
- * @param {string} props.id An HTML element id for the root element of ListView.
- * @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.
- * @param {Object} ref Forwarded ref
+ * @param {Object} props Components props.
+ * @param {string} props.id An HTML element id for the root element of ListView.
+ * @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.
+ * @param {boolean} props.selectBlockInCanvas Flag to determine whether the list view should be a block selection mechanism,.
+ * @param {Object} ref Forwarded ref
*/
function __ExperimentalOffCanvasEditor(
- { id, blocks, showBlockMovers = false, isExpanded = false },
+ {
+ id,
+ blocks,
+ showBlockMovers = false,
+ isExpanded = false,
+ selectBlockInCanvas = true,
+ },
ref
) {
const { clientIdsTree, draggedClientIds, selectedClientIds } =
@@ -199,6 +206,7 @@ function __ExperimentalOffCanvasEditor(
selectedClientIds={ selectedClientIds }
isExpanded={ isExpanded }
shouldShowInnerBlocks={ shouldShowInnerBlocks }
+ selectBlockInCanvas={ selectBlockInCanvas }
/>
diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js
index 918b609f92a0e..51e473fffdd68 100644
--- a/packages/block-library/src/navigation/edit/index.js
+++ b/packages/block-library/src/navigation/edit/index.js
@@ -9,6 +9,7 @@ import classnames from 'classnames';
import { useState, useEffect, useRef, Platform } from '@wordpress/element';
import { addQueryArgs } from '@wordpress/url';
import {
+ __experimentalOffCanvasEditor as OffCanvasEditor,
InspectorControls,
useBlockProps,
__experimentalRecursionProvider as RecursionProvider,
@@ -82,6 +83,9 @@ function Navigation( {
hasColorSettings = true,
customPlaceholder: CustomPlaceholder = null,
} ) {
+ const isOffCanvasNavigationEditorEnabled =
+ window?.__experimentalEnableOffCanvasNavigationEditor === true;
+
const {
openSubmenusOnClick,
overlayMenu,
@@ -676,18 +680,27 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
-
+ { isOffCanvasNavigationEditorEnabled && (
+
+ ) }
+ { ! isOffCanvasNavigationEditorEnabled && (
+
+ ) }
{ stylingInspectorControls }
@@ -759,18 +772,20 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
-
+ { ! isOffCanvasNavigationEditorEnabled && (
+
+ ) }
@@ -877,18 +892,27 @@ function Navigation( {
/* translators: %s: The name of a menu. */
actionLabel={ __( "Switch to '%s'" ) }
/>
-
+ { isOffCanvasNavigationEditorEnabled && (
+
+ ) }
+ { ! isOffCanvasNavigationEditorEnabled && (
+
+ ) }
{ stylingInspectorControls }
@@ -915,6 +939,21 @@ function Navigation( {
} }
/>
) }
+ { isOffCanvasNavigationEditorEnabled && (
+
+ ) }
) }
diff --git a/packages/block-library/src/navigation/editor.scss b/packages/block-library/src/navigation/editor.scss
index f669b39cb6586..9e7b9ff91e943 100644
--- a/packages/block-library/src/navigation/editor.scss
+++ b/packages/block-library/src/navigation/editor.scss
@@ -582,6 +582,13 @@ body.editor-styles-wrapper
margin-bottom: $grid-unit-20;
}
+// increased specificity to override button variant
+// for the manage menus button in the advanced area
+// of the navigation block
+.components-button.is-link.wp-block-navigation-manage-menus-button {
+ margin-bottom: $grid-unit-20;
+}
+
.wp-block-navigation__overlay-menu-preview {
display: flex;
align-items: center;