diff --git a/src/js/_enqueues/lib/admin-bar.js b/src/js/_enqueues/lib/admin-bar.js
index dbee866325..eb18c61f8b 100644
|
a
|
b
|
|
| 95 | 95 | } ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | | if ( skipLink ) { |
| 99 | | // Focus the target of skip link after pressing Enter. |
| 100 | | skipLink.addEventListener( 'keydown', focusTargetAfterEnter ); |
| 101 | | } |
| 102 | | |
| 103 | 98 | if ( shortlink ) { |
| 104 | 99 | shortlink.addEventListener( 'click', clickShortlink ); |
| 105 | 100 | } |
| … |
… |
|
| 173 | 168 | } |
| 174 | 169 | } |
| 175 | 170 | |
| 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 | | |
| 205 | 171 | /** |
| 206 | 172 | * Toggle hover class for mobile devices. |
| 207 | 173 | * |