2015-07-01 15:21:44 +00:00
|
|
|
/**
|
2015-12-15 09:09:54 +00:00
|
|
|
* File skip-link-focus-fix.js.
|
2015-07-01 15:21:44 +00:00
|
|
|
*
|
2015-08-03 19:14:14 +00:00
|
|
|
* Helps with accessibility for keyboard only users.
|
2015-07-01 15:21:44 +00:00
|
|
|
*
|
2015-10-29 17:25:18 +00:00
|
|
|
* Learn more: https://git.io/vWdr2
|
2015-07-01 15:21:44 +00:00
|
|
|
*/
|
2017-06-15 12:28:19 +00:00
|
|
|
( function() {
|
2016-11-26 17:42:51 +00:00
|
|
|
var isIe = /(trident|msie)/i.test( navigator.userAgent );
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2016-11-26 17:42:51 +00:00
|
|
|
if ( isIe && document.getElementById && window.addEventListener ) {
|
2014-04-15 09:40:29 +00:00
|
|
|
window.addEventListener( 'hashchange', function() {
|
2015-02-17 17:52:36 +00:00
|
|
|
var id = location.hash.substring( 1 ),
|
|
|
|
element;
|
|
|
|
|
2015-02-23 10:48:50 +00:00
|
|
|
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
|
2015-02-17 17:52:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
element = document.getElementById( id );
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2013-03-05 00:41:38 +00:00
|
|
|
if ( element ) {
|
2015-02-23 10:48:50 +00:00
|
|
|
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
|
2013-03-05 00:41:38 +00:00
|
|
|
element.tabIndex = -1;
|
2014-12-24 05:19:34 +00:00
|
|
|
}
|
2013-03-07 14:10:13 +00:00
|
|
|
|
2013-03-05 00:41:38 +00:00
|
|
|
element.focus();
|
|
|
|
}
|
2013-03-07 14:10:13 +00:00
|
|
|
}, false );
|
2013-03-05 00:41:38 +00:00
|
|
|
}
|
2020-04-05 20:49:27 +00:00
|
|
|
}() );
|