mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-30 23:39:42 +01:00
4e30de26c6
* Removes script from the `wp_print_footer_scripts` action in Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One. * Switches enqueue functions to just register the scripts in Twenty Fifteen, Twenty Sixteen, and Twenty Seventeen. * Rearranges Twenty Seventeen's scripts to connect `twentyseventeenScreenReaderText` with the global script instead of the unused skip link fix. * Updates scripts in Twenty Fifteen and Twenty Sixteen with code from Twenty Seventeen _to run on Internet Explorer only_. Twenty Sixteen needed to keep an adjustment that offsets the toolbar and border. * Removes the script from JS files in Twenty Thirteen and Twenty Fourteen and edits their modified dates. Props sabernhardt, westonruter, joedolson, flixos90, mukesh27. Fixes #54421. Built from https://develop.svn.wordpress.org/trunk@55861 git-svn-id: http://core.svn.wordpress.org/trunk@55373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
33 lines
686 B
JavaScript
33 lines
686 B
JavaScript
/**
|
|
* File skip-link-focus-fix.js.
|
|
*
|
|
* Helps with accessibility for keyboard only users.
|
|
*
|
|
* Learn more: https://git.io/vWdr2
|
|
*/
|
|
|
|
( function() {
|
|
var isIe = /(trident|msie)/i.test( navigator.userAgent );
|
|
|
|
if ( 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 );
|
|
}
|
|
} )();
|