Make WordPress Core

Ticket #60479: 60479.diff

File 60479.diff, 1.3 KB (added by joedolson, 13 months ago)
  • src/js/_enqueues/lib/admin-bar.js

     
    9595                        } );
    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 );
    105100                }
     
    173168        }
    174169
    175170        /**
    176          * Focus the target of skip link after pressing Enter.
    177          *
    178          * @since 5.3.1
    179          *
    180          * @param {Event} event The keydown event.
    181          */
    182         function focusTargetAfterEnter( event ) {
    183                 var id, userAgent;
    184 
    185                 if ( event.which !== 13 ) {
    186                         return;
    187                 }
    188 
    189                 id = event.target.getAttribute( 'href' );
    190                 userAgent = navigator.userAgent.toLowerCase();
    191 
    192                 if ( userAgent.indexOf( 'applewebkit' ) > -1 && id && id.charAt( 0 ) === '#' ) {
    193                         setTimeout( function() {
    194                                 var target = document.getElementById( id.replace( '#', '' ) );
    195 
    196                                 if ( target ) {
    197                                         target.setAttribute( 'tabIndex', '0' );
    198                                         target.focus();
    199                                 }
    200                         }, 100 );
    201                 }
    202         }
    203 
    204         /**
    205171         * Toogle hover class for mobile devices.
    206172         *
    207173         * @since 5.3.1