--- a/wp/wp-admin/js/nav-menu.js Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/js/nav-menu.js Fri Sep 05 18:40:08 2025 +0200
@@ -449,12 +449,13 @@
}
var thisLink, thisLinkText, primaryItems, itemPosition, title,
- parentItem, parentItemId, parentItemName, subItems,
+ parentItem, parentItemId, parentItemName, subItems, totalSubItems,
$this = $( itemToRefresh ),
menuItem = $this.closest( 'li.menu-item' ).first(),
depth = menuItem.menuItemDepth(),
isPrimaryMenuItem = ( 0 === depth ),
itemName = $this.closest( '.menu-item-handle' ).find( '.menu-item-title' ).text(),
+ menuItemType = $this.closest( '.menu-item-handle' ).find( '.item-controls' ).find( '.item-type' ).text(),
position = parseInt( menuItem.index(), 10 ),
prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1, 10 ),
prevItemNameLeft = menuItem.prevAll('.menu-item-depth-' + prevItemDepth).first().find( '.menu-item-title' ).text(),
@@ -503,18 +504,22 @@
primaryItems = $( '.menu-item-depth-0' ),
itemPosition = primaryItems.index( menuItem ) + 1,
totalMenuItems = primaryItems.length,
-
// String together help text for primary menu items.
- title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
+ title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$s', menuItemType ).replace( '%3$d', itemPosition ).replace( '%4$d', totalMenuItems );
} else {
parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
parentItemName = parentItem.find( '.menu-item-title' ).text(),
subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
+ totalSubItems = subItems.length,
itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
// String together help text for sub menu items.
- title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
+ if ( depth < 2 ) {
+ title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$s', menuItemType ).replace( '%3$d', itemPosition ).replace( '%4$d', totalSubItems ).replace( '%5$s', parentItemName );
+ } else {
+ title = menus.subMenuMoreDepthFocus.replace( '%1$s', itemName ).replace( '%2$s', menuItemType ).replace( '%3$d', itemPosition ).replace( '%4$d', totalSubItems ).replace( '%5$s', parentItemName ).replace( '%6$d', depth );
+ }
}
$this.attr( 'aria-label', title );
@@ -732,6 +737,7 @@
api.refreshKeyboardAccessibility();
api.refreshAdvancedAccessibility();
+ api.refreshAdvancedAccessibilityOfItem( ui.item.find( 'a.item-edit' ) );
},
change: function(e, ui) {
// Make sure the placeholder is inside the menu.
@@ -1557,4 +1563,19 @@
});
});
+ // Show bulk action.
+ $( document ).on( 'menu-item-added', function() {
+ if ( ! $( '.bulk-actions' ).is( ':visible' ) ) {
+ $( '.bulk-actions' ).show();
+ }
+ } );
+
+ // Hide bulk action.
+ $( document ).on( 'menu-removing-item', function( e, el ) {
+ var menuElement = $( el ).parents( '#menu-to-edit' );
+ if ( menuElement.find( 'li' ).length === 1 && $( '.bulk-actions' ).is( ':visible' ) ) {
+ $( '.bulk-actions' ).hide();
+ }
+ } );
+
})(jQuery);