From bd6dffc8d375d133eb4ff23c89b98cc067aead5f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 16 Oct 2018 10:34:49 -0700 Subject: [PATCH 1/3] Print skip-link-focus-fix inline instead of enqueueing as blocking script --- functions.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index b5d0f848..7e29840c 100644 --- a/functions.php +++ b/functions.php @@ -117,8 +117,6 @@ function twentynineteen_content_width() { function twentynineteen_scripts() { wp_enqueue_style( 'twentynineteen-style', get_stylesheet_uri() ); - wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); - if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) { wp_add_inline_style( 'twentynineteen-style', twentynineteen_header_featured_image_css() ); } @@ -129,6 +127,21 @@ function twentynineteen_scripts() { } add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' ); +/** + * Fix skip link focus in IE11. + * + * This does not enqueue the script because it is tiny and because it is only for IE11, + * thus it does not warrant having an entire dedicated blocking script being loaded. + * + * @link https://git.io/vWdr2 + */ +function twentynineteen_skip_link_focus_fix() { + echo ''; +} +add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' ); + /** * SVG Icons class. */ From 9d6515e88bb03b763d2696166235922420b1151d Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 23 Oct 2018 12:08:22 -0700 Subject: [PATCH 2/3] Minify skip-link-focus-fix.js to inline in twentynineteen_skip_link_focus_fix() --- functions.php | 3 ++- js/skip-link-focus-fix.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 2bfb5a6c..7b4ee3b5 100644 --- a/functions.php +++ b/functions.php @@ -155,7 +155,8 @@ function twentynineteen_scripts() { */ function twentynineteen_skip_link_focus_fix() { echo ''; } add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' ); diff --git a/js/skip-link-focus-fix.js b/js/skip-link-focus-fix.js index 0037752e..32ba80cc 100644 --- a/js/skip-link-focus-fix.js +++ b/js/skip-link-focus-fix.js @@ -3,6 +3,8 @@ * * Helps with accessibility for keyboard only users. * + * This is the source file for what is minified in the twentynineteen_skip_link_focus_fix() PHP function. + * * Learn more: https://git.io/vWdr2 */ ( function() { From 94c0655e386221aaab9a0d6768da2df833b46339 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 6 Nov 2018 08:38:52 -0800 Subject: [PATCH 3/3] Output script without echoes --- functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index e61507b1..c9420069 100644 --- a/functions.php +++ b/functions.php @@ -191,10 +191,12 @@ function twentynineteen_scripts() { * @link https://git.io/vWdr2 */ function twentynineteen_skip_link_focus_fix() { - echo ''; + ?> + +