From bebe6bcc6c385d39a909fd4e0d3a7e9c00a67d59 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Mon, 5 Dec 2022 16:04:51 +0000 Subject: [PATCH] Navigation: Removes the header from the navigation list view in the experiment (#46070) * Navigation: Removes the header from the navigation list view * Add a visually hidden menu header for accessiblity --- .../edit/menu-inspector-controls.js | 85 ++++++------------- .../edit/navigation-menu-selector.js | 27 ++---- 2 files changed, 34 insertions(+), 78 deletions(-) diff --git a/packages/block-library/src/navigation/edit/menu-inspector-controls.js b/packages/block-library/src/navigation/edit/menu-inspector-controls.js index 12d076951ce05b..cefc94a3dcce0a 100644 --- a/packages/block-library/src/navigation/edit/menu-inspector-controls.js +++ b/packages/block-library/src/navigation/edit/menu-inspector-controls.js @@ -5,11 +5,7 @@ import { __experimentalOffCanvasEditor as OffCanvasEditor, InspectorControls, } from '@wordpress/block-editor'; -import { - PanelBody, - __experimentalHStack as HStack, - __experimentalHeading as Heading, -} from '@wordpress/components'; +import { PanelBody, VisuallyHidden } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; /** @@ -22,7 +18,6 @@ const MenuInspectorControls = ( { createNavigationMenuIsSuccess, createNavigationMenuIsError, currentMenuId = null, - isNavigationMenuMissing, innerBlocks, isManageMenusButtonDisabled, onCreateNew, @@ -44,61 +39,37 @@ const MenuInspectorControls = ( { isOffCanvasNavigationEditorEnabled ? null : __( 'Menu' ) } > - { isOffCanvasNavigationEditorEnabled ? ( - <> - - - { __( 'Menu' ) } - - - - { currentMenuId && isNavigationMenuMissing ? ( -

{ __( 'Select or create a menu' ) }

- ) : ( - - ) } - - ) : ( - <> - + { isOffCanvasNavigationEditorEnabled && ( + + { __( 'Menu' ) } + + ) } + + { isOffCanvasNavigationEditorEnabled ? ( + + ) : ( - - ) } + ) } + ); diff --git a/packages/block-library/src/navigation/edit/navigation-menu-selector.js b/packages/block-library/src/navigation/edit/navigation-menu-selector.js index 4b1182475e8d5a..2d8594093bf105 100644 --- a/packages/block-library/src/navigation/edit/navigation-menu-selector.js +++ b/packages/block-library/src/navigation/edit/navigation-menu-selector.js @@ -10,7 +10,7 @@ import { VisuallyHidden, } from '@wordpress/components'; import { useEntityProp } from '@wordpress/core-data'; -import { Icon, chevronUp, chevronDown, moreVertical } from '@wordpress/icons'; +import { Icon, chevronUp, chevronDown } from '@wordpress/icons'; import { __, sprintf } from '@wordpress/i18n'; import { decodeEntities } from '@wordpress/html-entities'; import { useEffect, useMemo, useState } from '@wordpress/element'; @@ -31,9 +31,6 @@ function NavigationMenuSelector( { createNavigationMenuIsError, toggleProps = {}, } ) { - const isOffCanvasNavigationEditorEnabled = - window?.__experimentalEnableOffCanvasNavigationEditor === true; - /* translators: %s: The name of a menu. */ const createActionLabel = __( "Create from '%s'" ); @@ -143,11 +140,7 @@ function NavigationMenuSelector( { }, }; - if ( - ! hasNavigationMenus && - ! hasClassicMenus && - ! isOffCanvasNavigationEditorEnabled - ) { + if ( ! hasNavigationMenus && ! hasClassicMenus ) { return (