Skip to content

Commit

Permalink
Ensure appropriate fallback menu title in Nav block menu selector (#4…
Browse files Browse the repository at this point in the history
…7073)

* Ensure appropriate fallback

* Change the untitled name

Co-authored-by: Ben Dwyer <[email protected]>
  • Loading branch information
getdave and Ben Dwyer authored Jan 12, 2023
1 parent 9380c25 commit 7e52fbb
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ function NavigationMenuSelector( {

const menuChoices = useMemo( () => {
return (
navigationMenus?.map( ( { id, title } ) => {
const label = decodeEntities( title.rendered );
navigationMenus?.map( ( { id, title }, index ) => {
const label =
decodeEntities( title.rendered ) ||
/* translators: %s is the index of the menu in the list of menus. */
sprintf( __( '(no title %s)' ), index + 1 );

if ( id === currentMenuId && ! isCreatingMenu ) {
setSelectorLabel(
/* translators: %s is the name of a navigation menu. */
Expand Down

1 comment on commit 7e52fbb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 7e52fbb.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3904566240
📝 Reported issues:

Please sign in to comment.