diff options
Diffstat (limited to 'wp-includes/js/admin-bar.js')
-rw-r--r-- | wp-includes/js/admin-bar.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/wp-includes/js/admin-bar.js b/wp-includes/js/admin-bar.js index 8cb94ea..01b175d 100644 --- a/wp-includes/js/admin-bar.js +++ b/wp-includes/js/admin-bar.js @@ -31,7 +31,7 @@ topMenuItems = adminBar.querySelectorAll( 'li.menupop' ); allMenuItems = adminBar.querySelectorAll( '.ab-item' ); - adminBarLogout = document.getElementById( 'wp-admin-bar-logout' ); + adminBarLogout = document.querySelector( '#wp-admin-bar-logout a' ); adminBarSearchForm = document.getElementById( 'adminbarsearch' ); shortlink = document.getElementById( 'wp-admin-bar-get-shortlink' ); skipLink = adminBar.querySelector( '.screen-reader-shortcut' ); @@ -149,7 +149,8 @@ function toggleHoverIfEnter( event ) { var wrapper; - if ( event.which !== 13 ) { + // Follow link if pressing Ctrl and/or Shift with Enter (opening in a new tab or window). + if ( event.which !== 13 || event.ctrlKey || event.shiftKey ) { return; } @@ -336,6 +337,11 @@ element.className += className; } + + var menuItemToggle = element.querySelector( 'a' ); + if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) { + menuItemToggle.setAttribute( 'aria-expanded', 'true' ); + } } /** @@ -366,6 +372,11 @@ element.className = classes.replace( /^[\s]+|[\s]+$/g, '' ); } + + var menuItemToggle = element.querySelector( 'a' ); + if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) { + menuItemToggle.setAttribute( 'aria-expanded', 'false' ); + } } /** |