- Timestamp:
- 05/26/2023 05:23:49 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js
r30046 r55861 1 1 /** 2 * Makes "skip to content" link work correctly in IE9, Chrome, and Opera 3 * for better accessibility. 2 * File skip-link-focus-fix.js. 4 3 * 5 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ 4 * Helps with accessibility for keyboard only users. 5 * 6 * Learn more: https://git.io/vWdr2 6 7 */ 7 8 8 9 ( function() { 9 var ua = navigator.userAgent.toLowerCase();10 var isIe = /(trident|msie)/i.test( navigator.userAgent ); 10 11 11 if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) && 12 document.getElementById && window.addEventListener ) { 12 if ( isIe && document.getElementById && window.addEventListener ) { 13 window.addEventListener( 'hashchange', function() { 14 var id = location.hash.substring( 1 ), 15 element; 13 16 14 window.addEventListener( 'hashchange', function() { 15 var element = document.getElementById( location.hash.substring( 1 ) ); 17 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 18 return; 19 } 20 21 element = document.getElementById( id ); 16 22 17 23 if ( element ) { 18 if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName) ) {24 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 19 25 element.tabIndex = -1; 20 26 }
Note: See TracChangeset
for help on using the changeset viewer.