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( function() { 9 10 "use strict"; 11 12 var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, 13 isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, 14 isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; 15 16 if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) { 17 window.addEventListener( 'hashchange', function() { 18 var id = location.hash.substring( 1 ), 19 element; 20 21 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 22 return; 23 } 24 25 element = document.getElementById( id ); 26 27 if ( element ) { 28 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 29 element.tabIndex = -1; 30 } 31 32 element.focus(); 33 } 34 }, false ); 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.