mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Menus: Add audible notice on menu item add or remove.
Call `wp.a11y.speak()` to add audible notification when a menu item is added or removed from a menu. Props joedolson, costdev, hellofromTonya. Fixes #53840. Built from https://develop.svn.wordpress.org/trunk@52166 git-svn-id: http://core.svn.wordpress.org/trunk@51758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1f608d5d5c
commit
6912dc20b9
@ -311,7 +311,8 @@
|
||||
nextItemDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1,
|
||||
prevItem = thisItem.prev(),
|
||||
prevItemDepth = parseInt( prevItem.menuItemDepth(), 10 ),
|
||||
prevItemId = prevItem.getItemData()['menu-item-db-id'];
|
||||
prevItemId = prevItem.getItemData()['menu-item-db-id'],
|
||||
a11ySpeech = menus[ 'moved' + dir.charAt(0).toUpperCase() + dir.slice(1) ];
|
||||
|
||||
switch ( dir ) {
|
||||
case 'up':
|
||||
@ -399,6 +400,10 @@
|
||||
api.registerChange();
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
|
||||
if ( a11ySpeech ) {
|
||||
wp.a11y.speak( a11ySpeech );
|
||||
}
|
||||
},
|
||||
|
||||
initAccessibility : function() {
|
||||
@ -1224,6 +1229,7 @@
|
||||
$menuMarkup.hideAdvancedMenuItemFields().appendTo( api.targetList );
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
wp.a11y.speak( menus.itemAdded );
|
||||
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
||||
},
|
||||
|
||||
@ -1239,6 +1245,7 @@
|
||||
$menuMarkup.hideAdvancedMenuItemFields().prependTo( api.targetList );
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
wp.a11y.speak( menus.itemAdded );
|
||||
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
||||
},
|
||||
|
||||
@ -1513,6 +1520,7 @@
|
||||
ins.removeClass( 'menu-instructions-inactive' );
|
||||
}
|
||||
api.refreshAdvancedAccessibility();
|
||||
wp.a11y.speak( menus.itemRemoved );
|
||||
});
|
||||
},
|
||||
|
||||
|
2
wp-admin/js/nav-menu.min.js
vendored
2
wp-admin/js/nav-menu.min.js
vendored
File diff suppressed because one or more lines are too long
@ -499,6 +499,13 @@ $nav_menus_l10n = array(
|
||||
'menuItemDeletion' => __( 'item %s' ),
|
||||
/* translators: %s: Item name. */
|
||||
'itemsDeleted' => __( 'Deleted menu item: %s.' ),
|
||||
'itemAdded' => __( 'Menu item added' ),
|
||||
'itemRemoved' => __( 'Menu item removed' ),
|
||||
'movedUp' => __( 'Menu item moved up' ),
|
||||
'movedDown' => __( 'Menu item moved down' ),
|
||||
'movedTop' => __( 'Menu item moved to the top' ),
|
||||
'movedLeft' => __( 'Menu item moved out of submenu' ),
|
||||
'movedRight' => __( 'Menu item is now a sub-item' ),
|
||||
);
|
||||
wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-52165';
|
||||
$wp_version = '5.9-alpha-52166';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user