diff --git a/packages/block-library/src/navigation/index.js b/packages/block-library/src/navigation/index.js index 82ed856c565dab..7b0e6b8abef0fe 100644 --- a/packages/block-library/src/navigation/index.js +++ b/packages/block-library/src/navigation/index.js @@ -55,9 +55,9 @@ export const settings = { }, edit, save, - __experimentalLabel: ( { ref } ) => { - if ( ! ref ) { - return __( 'Navigation' ); + __experimentalLabel: ( { ref }, { context } ) => { + if ( ! ref || context !== 'list-view' ) { + return; } const navigation = select( coreStore ).getEditedEntityRecord( @@ -66,14 +66,20 @@ export const settings = { ref ); - return navigation?.title - ? sprintf( - /* translators: %1$s: block title, %2$s: navigation menu title */ - __( '%1$s (%2$s)' ), - metadata.title, - decodeEntities( navigation.title ) - ) - : __( 'Navigation' ); + if ( ! navigation?.title ) { + return; + } + + if ( navigation.title === metadata.title ) { + return; + } + + return sprintf( + // translators: %1$s: block title, %2$s: navigation title. + __( '%1$s (%2$s)' ), + metadata.title, + decodeEntities( navigation.title ) + ); }, deprecated, }; diff --git a/test/e2e/specs/site-editor/navigation-editor.spec.js b/test/e2e/specs/site-editor/navigation-editor.spec.js index 9810854d0c11bc..6723ae5968b9a6 100644 --- a/test/e2e/specs/site-editor/navigation-editor.spec.js +++ b/test/e2e/specs/site-editor/navigation-editor.spec.js @@ -40,11 +40,8 @@ test.describe( 'Editing Navigation Menus', () => { canvas: 'edit', } ); - // Wait for the toggle to be visible. await expect( - page.locator( - '.editor-document-tools__document-overview-toggle' - ) + page.getByRole( 'button', { name: 'Document Overview' } ) ).toBeVisible(); // Open List View.