CoreFiles by mySites.guru
skip-link-focus-fix.js26 lines, 727 bytes, from wordpress-4.3.21.zip
Raw History Compare with 4.3.20
md5
d774bf15e2e23e3a7bbb9afa92f4f0b6
sha1
9a82aa3fa1c6f0c921311b7fffe7626ffdd6bbfe
sha256
c99b9b0e6f18e2095f1552d926fbb566e5cd18b3867672d84689ca97a69b9479
/**
 * Makes "skip to content" link work correctly in IE9, Chrome, and Opera
 * for better accessibility.
 *
 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
 */

( function() {
	var ua = navigator.userAgent.toLowerCase();

	if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) &&
		document.getElementById && window.addEventListener ) {

		window.addEventListener( 'hashchange', function() {
			var element = document.getElementById( location.hash.substring( 1 ) );

			if ( element ) {
				if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) {
					element.tabIndex = -1;
				}

				element.focus();
			}
		}, false );
	}
} )();

The same content is in 419 releases, WordPress 4.1-beta1 to 5.0-beta4. See them all, or every version of this file.