From a02ab351280428db147c35330582d1a14a11f7eb Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Thu, 3 Nov 2016 23:07:20 +0000 Subject: [PATCH] Twenty Seventeen: Make sure skip link works in all versions of Internet Explorer This also reduces the number of browsers detected and patched with this fix. Most modern browsers have patched this common bug, where an anchor link does not move focus when clicked. Twenty Seventeen will only worry about older versions of Internet Explorer in this regard. Props afercia, sami.keijonen. See #38604. git-svn-id: https://develop.svn.wordpress.org/trunk@39135 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentyseventeen/assets/js/skip-link-focus-fix.js | 6 ++---- src/wp-content/themes/twentyseventeen/style.css | 6 ------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js b/src/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js index a39cefbfe1..0d5b4203ab 100644 --- a/src/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js +++ b/src/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js @@ -6,11 +6,9 @@ * 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; + 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; diff --git a/src/wp-content/themes/twentyseventeen/style.css b/src/wp-content/themes/twentyseventeen/style.css index acd1b61a4d..a1fbe7254d 100644 --- a/src/wp-content/themes/twentyseventeen/style.css +++ b/src/wp-content/themes/twentyseventeen/style.css @@ -330,12 +330,6 @@ template { z-index: 100000; /* Above WP toolbar. */ } -/* Do not show the outline on the skip link target. */ - -#content[tabindex="-1"]:focus { - outline: 0; -} - /*-------------------------------------------------------------- # Alignments --------------------------------------------------------------*/