Make WordPress Core

Ticket #60479: 60479.patch

File 60479.patch, 1.2 KB (added by shailu25, 12 months ago)

Patch Refresh

  • src/js/_enqueues/lib/admin-bar.js

    diff --git a/src/js/_enqueues/lib/admin-bar.js b/src/js/_enqueues/lib/admin-bar.js
    index dbee866325..eb18c61f8b 100644
    a b  
    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         /**
    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 );
    202                 }
    203         }
    204 
    205171        /**
    206172         * Toggle hover class for mobile devices.
    207173         *