From 30883c26bdceb9eaf32c8d4a1b0c1bce223b5226 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 09:57:26 +0200 Subject: Adding upstream version 6.5+dfsg1. Signed-off-by: Daniel Baumann --- wp-includes/js/admin-bar.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'wp-includes/js/admin-bar.js') 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' ); + } } /** -- cgit v1.2.3