From 9a988eae35bcb44981afe515da49b098b0b6b355 Mon Sep 17 00:00:00 2001 From: Sami Keijonen Date: Sat, 26 Nov 2016 19:42:51 +0200 Subject: [PATCH] Fix skip link focus. --- js/skip-link-focus-fix.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/js/skip-link-focus-fix.js b/js/skip-link-focus-fix.js index a39cefbf..a40ebacf 100644 --- a/js/skip-link-focus-fix.js +++ b/js/skip-link-focus-fix.js @@ -5,12 +5,10 @@ * * 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; +(function() { + var isIe = /(trident|msie)/i.test( navigator.userAgent ); - if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) { + if ( isIe && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var id = location.hash.substring( 1 ), element;