mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-14 04:01:54 +01:00
7fbb094586
With a focus on business sites, it will let you get down to business in style. Initial development occurred on GitHub. See: https://github.com/WordPress/twentyseventeen Props melchoyce, laurelfulford, davidakennedy, grapplerulrich, manishsongirkar36, joefusco, smyoon315, b-07, rabmalin, mrahmadawais, hardeepasrani, implenton, acmethemes, claudiosanches, valeriutihai, pressionate, sgr33n, doughamlin, zodiac1978, tsl143, nikschavan, joshcummingsdesign, enodekciw, jordesign, patilvikasj, ryelle, mahesh901122, williampatton, juanfra, imnok, littlebigthing, mor10, samikeijonen, celloexpressions, akshayvinchurkar, davidmosterd, hiddenpearls, netweb, pratikchaskar, taggon, nukaga, ranh, yoavf, karmatosed, sandesh055, adammacias, noplanman, yogasukma, binarymoon, swapnilld, swissspidy, joyously, allancole, rianrietveld, sixhours, alex27, themeshaper, mapk, leobaiano. See #38372. Built from https://develop.svn.wordpress.org/trunk@38833 git-svn-id: http://core.svn.wordpress.org/trunk@38776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
34 lines
880 B
JavaScript
34 lines
880 B
JavaScript
/**
|
|
* File skip-link-focus-fix.js.
|
|
*
|
|
* Helps with accessibility for keyboard only users.
|
|
*
|
|
* Learn more: https://git.io/vWdr2
|
|
*/
|
|
( function() {
|
|
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
|
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
|
isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
|
|
|
if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
|
|
window.addEventListener( 'hashchange', function() {
|
|
var id = location.hash.substring( 1 ),
|
|
element;
|
|
|
|
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
|
|
return;
|
|
}
|
|
|
|
element = document.getElementById( id );
|
|
|
|
if ( element ) {
|
|
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
|
|
element.tabIndex = -1;
|
|
}
|
|
|
|
element.focus();
|
|
}
|
|
}, false );
|
|
}
|
|
})();
|