Twenty Twenty-One: Prevent printing skip link focus fix when SCRIPT_DEBUG is enabled.

An `else` statement was missing in `twenty_twenty_one_skip_link_focus_fix()`. See ba83586ff1.

Fixes #54429.


git-svn-id: https://develop.svn.wordpress.org/trunk@52147 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2021-11-12 16:06:35 +00:00
parent 2ff7174e7c
commit e4132b5a61

View File

@ -496,14 +496,14 @@ function twenty_twenty_one_skip_link_focus_fix() {
echo '<script>';
include get_template_directory() . '/assets/js/skip-link-focus-fix.js';
echo '</script>';
} else {
// The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
?>
<script>
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",(function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}),!1);
</script>
<?php
}
// The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
?>
<script>
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",(function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}),!1);
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' );