Skip to content

Commit

Permalink
Toolbar: Accessibility: Remove adminbar skiplink focus fix.
Browse files Browse the repository at this point in the history
Based on the current browser support policies and expectations, this is no longer needed. There are almost no browsers in use where this is still in use. The same fix was removed from core themes in #54421.

Props joedolson, sabernhardt, shailu25.
Fixes #60479.

git-svn-id: https://develop.svn.wordpress.org/trunk@58133 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joedolson committed May 11, 2024
1 parent 2ab3606 commit 5e2cba2
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions src/js/_enqueues/lib/admin-bar.js
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -173,35 +168,6 @@
}
}

/**
* 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 );
}
}

/**
* Toggle hover class for mobile devices.
*
Expand Down

0 comments on commit 5e2cba2

Please sign in to comment.