Make WordPress Core

Changeset 58133


Ignore:
Timestamp:
05/11/2024 06:26:06 PM (9 months ago)
Author:
joedolson
Message:

Toolbar: Accessibility: Remove adminbar skiplink focus fix.

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/admin-bar.js

    r57987 r58133  
    9696        }
    9797
    98         if ( skipLink ) {
    99             // Focus the target of skip link after pressing Enter.
    100             skipLink.addEventListener( 'keydown', focusTargetAfterEnter );
    101         }
    102 
    10398        if ( shortlink ) {
    10499            shortlink.addEventListener( 'click', clickShortlink );
     
    171166        } else {
    172167            addClass( wrapper, 'hover' );
    173         }
    174     }
    175 
    176     /**
    177      * Focus the target of skip link after pressing Enter.
    178      *
    179      * @since 5.3.1
    180      *
    181      * @param {Event} event The keydown event.
    182      */
    183     function focusTargetAfterEnter( event ) {
    184         var id, userAgent;
    185 
    186         if ( event.which !== 13 ) {
    187             return;
    188         }
    189 
    190         id = event.target.getAttribute( 'href' );
    191         userAgent = navigator.userAgent.toLowerCase();
    192 
    193         if ( userAgent.indexOf( 'applewebkit' ) > -1 && id && id.charAt( 0 ) === '#' ) {
    194             setTimeout( function() {
    195                 var target = document.getElementById( id.replace( '#', '' ) );
    196 
    197                 if ( target ) {
    198                     target.setAttribute( 'tabIndex', '0' );
    199                     target.focus();
    200                 }
    201             }, 100 );
    202168        }
    203169    }
Note: See TracChangeset for help on using the changeset viewer.