Add all instances of menu to toggle current state.

This commit is contained in:
Jonathan Belcher 2018-10-10 12:06:32 -04:00
parent a947d304dc
commit 9d337ce8e0
1 changed files with 5 additions and 3 deletions

View File

@ -72,9 +72,11 @@ window.wpNavMenuClassChange = function( menuClass, pathname ) {
submenu.classList.add( 'wp-not-current-submenu' );
submenu.classList.add( 'menu-top' );
document
.querySelector( `li > a[href$="admin.php?page=wc-admin${ path }"]` )
.parentElement.classList.add( 'current' );
Array.from(
document.querySelectorAll( `li > a[href$="admin.php?page=wc-admin${ path }"]` )
).forEach( function( item ) {
item.parentElement.classList.add( 'current' );
} );
const currentMenu = document.querySelector( '#' + menuClass );
currentMenu.classList.remove( 'wp-not-current-submenu' );