diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index 2b7f31c3c7c5e5..923b2d4fd88555 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -225,7 +225,11 @@ export default function PageListEdit( { page.title?.rendered?.trim() !== '' ? page.title?.rendered : __( '(no title)' ), - title: page.title?.rendered, + title: + // translators: displayed when a page has an empty title. + page.title?.rendered?.trim() !== '' + ? page.title?.rendered + : __( '(no title)' ), link: page.url, hasChildren, }; diff --git a/packages/block-library/src/page-list/index.php b/packages/block-library/src/page-list/index.php index 4ff57e1a36a23e..a574633d4ddf47 100644 --- a/packages/block-library/src/page-list/index.php +++ b/packages/block-library/src/page-list/index.php @@ -192,7 +192,9 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $css_class .= ' menu-item-home'; } - $title = wp_kses_post( $page['title'] ); + $title = wp_kses_post( $page['title'] ); + $title = $title ? $title : __( '(no title)' ); + $aria_label = sprintf( /* translators: Accessibility text. %s: Parent page title. */ __( '%s submenu' ),