From b1664d1bcc62a6c6ba60d59cc6739c9addd2bd49 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 25 Jun 2021 15:01:23 +0100 Subject: [PATCH] Fix: template editor header area is difficult to navigate with screen readers (#32938) --- .../components/header/header-toolbar/index.js | 3 - .../edit-post/src/components/header/index.js | 2 + .../components/header/template-title/index.js | 97 +++++++++---------- 3 files changed, 46 insertions(+), 56 deletions(-) diff --git a/packages/edit-post/src/components/header/header-toolbar/index.js b/packages/edit-post/src/components/header/header-toolbar/index.js index a7581187b71166..259d376c190e1d 100644 --- a/packages/edit-post/src/components/header/header-toolbar/index.js +++ b/packages/edit-post/src/components/header/header-toolbar/index.js @@ -23,7 +23,6 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; /** * Internal dependencies */ -import TemplateTitle from '../template-title'; import { store as editPostStore } from '../../../store'; function HeaderToolbar() { @@ -156,8 +155,6 @@ function HeaderToolbar() { ) } - - ); } diff --git a/packages/edit-post/src/components/header/index.js b/packages/edit-post/src/components/header/index.js index c24e41ec59b411..40e5fa91239e0b 100644 --- a/packages/edit-post/src/components/header/index.js +++ b/packages/edit-post/src/components/header/index.js @@ -21,6 +21,7 @@ import PostPublishButtonOrToggle from './post-publish-button-or-toggle'; import { default as DevicePreview } from '../device-preview'; import MainDashboardButton from './main-dashboard-button'; import { store as editPostStore } from '../../store'; +import TemplateTitle from './template-title'; function Header( { setEntitiesSavedStatesCallback } ) { const { @@ -59,6 +60,7 @@ function Header( { setEntitiesSavedStatesCallback } ) {
+
{ ! isPublishSidebarOpened && ( diff --git a/packages/edit-post/src/components/header/template-title/index.js b/packages/edit-post/src/components/header/template-title/index.js index a2cd8b0ca07f78..21431ee1e319c0 100644 --- a/packages/edit-post/src/components/header/template-title/index.js +++ b/packages/edit-post/src/components/header/template-title/index.js @@ -3,7 +3,7 @@ */ import { __, sprintf } from '@wordpress/i18n'; import { useSelect, useDispatch } from '@wordpress/data'; -import { Dropdown, ToolbarItem, Button } from '@wordpress/components'; +import { Dropdown, Button } from '@wordpress/components'; import { chevronDown } from '@wordpress/icons'; /** @@ -47,59 +47,50 @@ function TemplateTitle() { } return ( - - { ( toolbarItemHTMLProps ) => { - return ( - ( - <> - - - +
+ + ( + + ) } + renderContent={ () => ( + <> + { template.has_theme_file ? ( + + ) : ( + ) } - renderContent={ () => ( - <> - { template.has_theme_file ? ( - - ) : ( - - ) } - - - ) } - /> - ); - } } - + + + ) } + /> +
); }