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,
|
nextItemDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1,
|
||||||
prevItem = thisItem.prev(),
|
prevItem = thisItem.prev(),
|
||||||
prevItemDepth = parseInt( prevItem.menuItemDepth(), 10 ),
|
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 ) {
|
switch ( dir ) {
|
||||||
case 'up':
|
case 'up':
|
||||||
|
@ -399,6 +400,10 @@
|
||||||
api.registerChange();
|
api.registerChange();
|
||||||
api.refreshKeyboardAccessibility();
|
api.refreshKeyboardAccessibility();
|
||||||
api.refreshAdvancedAccessibility();
|
api.refreshAdvancedAccessibility();
|
||||||
|
|
||||||
|
if ( a11ySpeech ) {
|
||||||
|
wp.a11y.speak( a11ySpeech );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initAccessibility : function() {
|
initAccessibility : function() {
|
||||||
|
@ -1224,6 +1229,7 @@
|
||||||
$menuMarkup.hideAdvancedMenuItemFields().appendTo( api.targetList );
|
$menuMarkup.hideAdvancedMenuItemFields().appendTo( api.targetList );
|
||||||
api.refreshKeyboardAccessibility();
|
api.refreshKeyboardAccessibility();
|
||||||
api.refreshAdvancedAccessibility();
|
api.refreshAdvancedAccessibility();
|
||||||
|
wp.a11y.speak( menus.itemAdded );
|
||||||
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1239,6 +1245,7 @@
|
||||||
$menuMarkup.hideAdvancedMenuItemFields().prependTo( api.targetList );
|
$menuMarkup.hideAdvancedMenuItemFields().prependTo( api.targetList );
|
||||||
api.refreshKeyboardAccessibility();
|
api.refreshKeyboardAccessibility();
|
||||||
api.refreshAdvancedAccessibility();
|
api.refreshAdvancedAccessibility();
|
||||||
|
wp.a11y.speak( menus.itemAdded );
|
||||||
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
$( document ).trigger( 'menu-item-added', [ $menuMarkup ] );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1513,6 +1520,7 @@
|
||||||
ins.removeClass( 'menu-instructions-inactive' );
|
ins.removeClass( 'menu-instructions-inactive' );
|
||||||
}
|
}
|
||||||
api.refreshAdvancedAccessibility();
|
api.refreshAdvancedAccessibility();
|
||||||
|
wp.a11y.speak( menus.itemRemoved );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -499,6 +499,13 @@ $nav_menus_l10n = array(
|
||||||
'menuItemDeletion' => __( 'item %s' ),
|
'menuItemDeletion' => __( 'item %s' ),
|
||||||
/* translators: %s: Item name. */
|
/* translators: %s: Item name. */
|
||||||
'itemsDeleted' => __( 'Deleted menu item: %s.' ),
|
'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 );
|
wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue