--- a/wp/wp-includes/js/admin-bar.js Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/js/admin-bar.js Fri Sep 05 18:40:08 2025 +0200
@@ -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' );
@@ -95,11 +95,6 @@
} );
}
- if ( skipLink ) {
- // Focus the target of skip link after pressing Enter.
- skipLink.addEventListener( 'keydown', focusTargetAfterEnter );
- }
-
if ( shortlink ) {
shortlink.addEventListener( 'click', clickShortlink );
}
@@ -149,7 +144,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;
}
@@ -173,36 +169,7 @@
}
/**
- * Focus the target of skip link after pressing Enter.
- *
- * @since 5.3.1
- *
- * @param {Event} event The keydown event.
- */
- function focusTargetAfterEnter( event ) {
- var id, userAgent;
-
- if ( event.which !== 13 ) {
- return;
- }
-
- id = event.target.getAttribute( 'href' );
- userAgent = navigator.userAgent.toLowerCase();
-
- if ( userAgent.indexOf( 'applewebkit' ) > -1 && id && id.charAt( 0 ) === '#' ) {
- setTimeout( function() {
- var target = document.getElementById( id.replace( '#', '' ) );
-
- if ( target ) {
- target.setAttribute( 'tabIndex', '0' );
- target.focus();
- }
- }, 100 );
- }
- }
-
- /**
- * Toogle hover class for mobile devices.
+ * Toggle hover class for mobile devices.
*
* @since 5.3.1
*
@@ -336,6 +303,11 @@
element.className += className;
}
+
+ var menuItemToggle = element.querySelector( 'a' );
+ if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) {
+ menuItemToggle.setAttribute( 'aria-expanded', 'true' );
+ }
}
/**
@@ -366,6 +338,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' );
+ }
}
/**