1/** 2 * File skip-link-focus-fix.js. 3 * 4 * Helps with accessibility for keyboard only users. 5 * 6 * Learn more: https://git.io/vWdr2 7 * 8 */ 9 10( function() { 11 const isIe = /(trident|msie)/i.test( navigator.userAgent ); 12 13 if ( isIe && document.getElementById && window.addEventListener ) { 14 window.addEventListener( 15 'hashchange', 16 function() { 17 const id = location.hash.substring( 1 ); 18 19 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 20 return; 21 } 22 23 const element = document.getElementById( id ); 24 25 if ( element ) { 26 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 27 element.tabIndex = -1; 28 } 29 30 element.focus(); 31 } 32 }, 33 false 34 ); 35 } 36}() );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.