Skip to content

Commit

Permalink
Add h1 to site editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Jul 11, 2024
1 parent 20f063e commit 6c3333f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import clsx from 'clsx';
* WordPress dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';
import { Button } from '@wordpress/components';
import { Button, VisuallyHidden } from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import {
EditorKeyboardShortcutsRegister,
Expand Down Expand Up @@ -95,7 +95,7 @@ export default function EditSiteEditor( { isPostsList = false } ) {
'trash',
};
}, [] );
useEditorTitle();
const editorTitle = useEditorTitle();
const _isPreviewingTheme = isPreviewingTheme();
const hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();
const iframeProps = useEditorIframeProps();
Expand Down Expand Up @@ -182,6 +182,11 @@ export default function EditSiteEditor( { isPostsList = false } ) {

return (
<>
<VisuallyHidden as="h1">
{ editorTitle
? decodeEntities( editorTitle )
: __( 'No Title' ) }
</VisuallyHidden>
<GlobalStylesRenderer />
<EditorKeyboardShortcutsRegister />
{ isEditMode && <BlockKeyboardShortcuts /> }
Expand Down
2 changes: 2 additions & 0 deletions packages/edit-site/src/components/editor/use-editor-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function useEditorTitle() {
// Only announce the title once the editor is ready to prevent "Replace"
// action in <URLQueryController> from double-announcing.
useTitle( hasLoadedPost && title );

return title;
}

export default useEditorTitle;

0 comments on commit 6c3333f

Please sign in to comment.