File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
packages/block-library/src/navigation/edit Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 33 */
44import { MenuGroup , MenuItem , MenuItemsChoice } from '@wordpress/components' ;
55import { useEntityId } from '@wordpress/core-data' ;
6- import { __ } from '@wordpress/i18n' ;
6+ import { __ , sprintf } from '@wordpress/i18n' ;
7+ import { decodeEntities } from '@wordpress/html-entities' ;
78
89/**
910 * Internal dependencies
@@ -26,10 +27,18 @@ export default function NavigationMenuSelector( { onSelect, onCreateNew } ) {
2627 )
2728 )
2829 }
29- choices = { navigationMenus . map ( ( { id, title } ) => ( {
30- value : id ,
31- label : title . rendered ,
32- } ) ) }
30+ choices = { navigationMenus . map ( ( { id, title } ) => {
31+ const label = decodeEntities ( title . rendered ) ;
32+ return {
33+ value : id ,
34+ label,
35+ 'aria-label' : sprintf (
36+ /* translators: %s: The name of a menu. */
37+ __ ( "Switch to '%s'" ) ,
38+ label
39+ ) ,
40+ } ;
41+ } ) }
3342 />
3443 </ MenuGroup >
3544 < MenuGroup >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { useDispatch } from '@wordpress/data';
1414import { useCallback , useState , useEffect } from '@wordpress/element' ;
1515import { __ } from '@wordpress/i18n' ;
1616import { navigation , Icon } from '@wordpress/icons' ;
17+ import { decodeEntities } from '@wordpress/html-entities' ;
1718
1819/**
1920 * Internal dependencies
@@ -59,7 +60,9 @@ const ExistingMenusDropdown = ( {
5960 onClose = { onClose }
6061 key = { menu . id }
6162 >
62- { menu . title . rendered }
63+ { decodeEntities (
64+ menu . title . rendered
65+ ) }
6366 </ MenuItem >
6467 ) ;
6568 } ) }
@@ -75,7 +78,7 @@ const ExistingMenusDropdown = ( {
7578 onClose = { onClose }
7679 key = { menu . id }
7780 >
78- { menu . name }
81+ { decodeEntities ( menu . name ) }
7982 </ MenuItem >
8083 ) ;
8184 } ) }
You can’t perform that action at this time.
0 commit comments