Make WordPress Core

Changeset 52147


Ignore:
Timestamp:
11/12/2021 04:06:35 PM (3 years ago)
Author:
westonruter
Message:

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 https://github.com/WordPress/twentytwentyone/pull/585/commits/ba83586ff1426fc4a0248f45d27ad0b4f5b7bbd4.

Fixes #54429.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/functions.php

    r51820 r52147  
    497497        include get_template_directory() . '/assets/js/skip-link-focus-fix.js';
    498498        echo '</script>';
    499     }
    500 
    501     // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
    502     ?>
    503     <script>
    504     /(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);
    505     </script>
    506     <?php
     499    } else {
     500        // The following is minified via `npx terser --compress --mangle -- assets/js/skip-link-focus-fix.js`.
     501        ?>
     502        <script>
     503        /(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);
     504        </script>
     505        <?php
     506    }
    507507}
    508508add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' );
Note: See TracChangeset for help on using the changeset viewer.