Customize: Ensure that nav menu items can be shift-clicked to edit in secondary instances of the same nav menu.

When the same nav menu is shown multiple times on a page, only the first instance of the nav menu will include `id` attributes. Subsequent instances will have the `id` attributes omitted. However, in both cases the underlying nav menu item's post ID is available among the `class` names, so the post ID can be more reliably obtained from `class` instead of the `id` attribute.  

Amends [36383].
Fixes #32681.


git-svn-id: https://develop.svn.wordpress.org/trunk@36523 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2016-02-13 00:11:24 +00:00
parent b5a54ae692
commit 9a108e99b5

View File

@@ -279,7 +279,7 @@
* Connect nav menu items with their corresponding controls in the pane.
*/
highlightControls: function() {
var selector = '.menu-item[id^=menu-item-]',
var selector = '.menu-item',
addTooltips;
// Open expand the menu item control when shift+clicking the menu item
@@ -289,7 +289,7 @@
return;
}
navMenuItemParts = $( this ).attr( 'id' ).match( /^menu-item-(\d+)$/ );
navMenuItemParts = $( this ).attr( 'class' ).match( /(?:^|\s)menu-item-(\d+)(?:\s|$)/ );
if ( navMenuItemParts ) {
e.preventDefault();
e.stopPropagation(); // Make sure a sub-nav menu item will get focused instead of parent items.