From b063a701940ea0ca80acc665b9ab2a4f5ab6b239 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Thu, 12 Mar 2026 11:19:19 -0500 Subject: [PATCH] Add isNavigationPostEditorKey symbol to fix menu display context --- packages/block-editor/src/private-apis.js | 2 ++ packages/block-editor/src/store/private-keys.js | 1 + packages/block-library/src/navigation/edit/index.js | 10 ++++++---- .../components/provider/use-block-editor-settings.js | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index 417cd8d03567bf..deda5597555a40 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -48,6 +48,7 @@ import { deviceTypeKey, isIsolatedEditorKey, isNavigationOverlayContextKey, + isNavigationPostEditorKey, mediaUploadOnSuccessKey, } from './store/private-keys'; import { requiresWrapperOnCopy } from './components/writing-flow/utils'; @@ -130,6 +131,7 @@ lock( privateApis, { deviceTypeKey, isIsolatedEditorKey, isNavigationOverlayContextKey, + isNavigationPostEditorKey, mediaUploadOnSuccessKey, useBlockElement, useBlockElementRef, diff --git a/packages/block-editor/src/store/private-keys.js b/packages/block-editor/src/store/private-keys.js index d3caa5c4f0172a..7d7a2d1884af00 100644 --- a/packages/block-editor/src/store/private-keys.js +++ b/packages/block-editor/src/store/private-keys.js @@ -10,4 +10,5 @@ export const deviceTypeKey = Symbol( 'deviceTypeKey' ); export const isNavigationOverlayContextKey = Symbol( 'isNavigationOverlayContext' ); +export const isNavigationPostEditorKey = Symbol( 'isNavigationPostEditor' ); export const mediaUploadOnSuccessKey = Symbol( 'mediaUploadOnSuccess' ); diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index ad2efb31ab2a15..375f897321866f 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -86,7 +86,7 @@ import { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA, } from '../constants'; -const { isIsolatedEditorKey } = unlock( blockEditorPrivateApis ); +const { isNavigationPostEditorKey } = unlock( blockEditorPrivateApis ); /** * Component that renders the Add page button for the Navigation block. @@ -330,15 +330,17 @@ function Navigation( { } = useSelect( ( select ) => { const { getSettings } = select( blockEditorStore ); const settings = getSettings(); + return { isPreviewMode: settings.isPreviewMode, onNavigateToEntityRecord: settings?.onNavigateToEntityRecord, // Needed to construct the template part ID for the overlay preview. currentTheme: select( coreStore ).getCurrentTheme()?.stylesheet, - // In preview mode or isolated editor, always show navigation expanded (no hamburger) - // so users can see and interact with all menu items. + // When editing a navigation post directly in an isolated editor, + // always show navigation expanded (no hamburger) so users can see + // and interact with all menu items. editorDisabledResponsive: - settings.isPreviewMode || !! settings?.[ isIsolatedEditorKey ], + !! settings?.[ isNavigationPostEditorKey ], }; }, [] ); const hasAlreadyRendered = isPreviewMode ? false : recursionDetected; diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 1e42727c80d7df..54d6490dc5636b 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -104,6 +104,7 @@ const { isIsolatedEditorKey, deviceTypeKey, isNavigationOverlayContextKey, + isNavigationPostEditorKey, mediaUploadOnSuccessKey, } = unlock( privateApis ); @@ -391,6 +392,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) { 'wp_block', 'wp_navigation', ].includes( postType ), + [ isNavigationPostEditorKey ]: postType === 'wp_navigation', // When in template-locked mode (e.g., "Show Template" in the post editor), // don't treat template parts as contentOnly sections. disableContentOnlyForTemplateParts: