Skip to Content

JavaScript File

URL: https://imam.web.id/wp-content/themes/chromenews/js/skip-link-focus-fix.js?ver=20151215
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Sat, 12 Feb 2022 20:18:46 GMT
Download Time: Less than a second
Cookies: None
Size: 1 KB
HTTP Headers:  20 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
  
OK Issues: No issues found

1/**

2 * File skip-link-focus-fix.js.

3 *

4 * Helps with accessibility for keyboard only users.

5 *

6 * Learn more: https://git.io/vWdr2

7 */

8( function() {

9 var isIe = /(trident|msie)/i.test( navigator.userAgent );

10

11 if ( isIe && document.getElementById && window.addEventListener ) {

12 window.addEventListener( 'hashchange', function() {

13 var id = location.hash.substring( 1 ),

14 element;

15

16 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {

17 return;

18 }

19

20 element = document.getElementById( id );

21

22 if ( element ) {

23 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {

24 element.tabIndex = -1;

25 }

26

27 element.focus();

28 }

29 }, false );

30 }

31} )();