Bundled Themes: Remove/disable obsolete IE-specific skip-link-focus-fix.

* Removes script from the `wp_print_footer_scripts` action in Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One.
* Switches enqueue functions to just register the scripts in Twenty Fifteen, Twenty Sixteen, and Twenty Seventeen.
* Rearranges Twenty Seventeen's scripts to connect `twentyseventeenScreenReaderText` with the global script instead of the unused skip link fix.
* Updates scripts in Twenty Fifteen and Twenty Sixteen with code from Twenty Seventeen _to run on Internet Explorer only_. Twenty Sixteen needed to keep an adjustment that offsets the toolbar and border.
* Removes the script from JS files in Twenty Thirteen and Twenty Fourteen and edits their modified dates.

Props sabernhardt, westonruter, joedolson, flixos90, mukesh27.
Fixes #54421.

Built from https://develop.svn.wordpress.org/trunk@55861


git-svn-id: http://core.svn.wordpress.org/trunk@55373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2023-05-26 17:25:23 +00:00
parent 9296612464
commit 4e30de26c6
13 changed files with 41 additions and 76 deletions

View File

@ -435,7 +435,8 @@ function twentyfifteen_scripts() {
wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141210' ); wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141210' );
wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' ); wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' );
wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141028', true ); // Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );

View File

@ -1,21 +1,27 @@
/** /**
* Makes "skip to content" link work correctly in IE9, Chrome, and Opera * File skip-link-focus-fix.js.
* for better accessibility.
* *
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ * Helps with accessibility for keyboard only users.
*
* Learn more: https://git.io/vWdr2
*/ */
( function() { ( function() {
var ua = navigator.userAgent.toLowerCase(); var isIe = /(trident|msie)/i.test( navigator.userAgent );
if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) &&
document.getElementById && window.addEventListener ) {
if ( isIe && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() { window.addEventListener( 'hashchange', function() {
var element = document.getElementById( location.hash.substring( 1 ) ); var id = location.hash.substring( 1 ),
element;
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
return;
}
element = document.getElementById( id );
if ( element ) { if ( element ) {
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) { if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
element.tabIndex = -1; element.tabIndex = -1;
} }

View File

@ -371,7 +371,7 @@ function twentyfourteen_scripts() {
); );
} }
wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20210122', true ); wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', true );
} }
add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );

View File

@ -1,8 +1,8 @@
/** /**
* Theme functions file. * Theme functions file.
* *
* Contains handlers for navigation, accessibility, header sizing * Contains handlers for navigation, accessibility, header sizing,
* footer widgets and Featured Content slider * footer widgets and Featured Content slider.
* *
*/ */
( function( $ ) { ( function( $ ) {
@ -38,33 +38,6 @@
} ); } );
} )(); } )();
/*
* Makes "skip to content" link work correctly in IE9 and Chrome for better
* accessibility.
*
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
*/
_window.on( 'hashchange.twentyfourteen', function() {
var hash = location.hash.substring( 1 ), element;
if ( ! hash ) {
return;
}
element = document.getElementById( hash );
if ( element ) {
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
element.tabIndex = -1;
}
element.focus();
// Repositions the window on jump-to-anchor to account for header height.
window.scrollBy( 0, -80 );
}
} );
$( function() { $( function() {
// Search toggle. // Search toggle.
$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) { $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {

View File

@ -284,6 +284,9 @@ add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );
* This does not enqueue the script because it is tiny and because it is only for 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. * thus it does not warrant having an entire dedicated blocking script being loaded.
* *
* @since Twenty Nineteen 1.0
* @deprecated Twenty Nineteen 2.6 Removed from wp_print_footer_scripts action.
*
* @link https://git.io/vWdr2 * @link https://git.io/vWdr2
*/ */
function twentynineteen_skip_link_focus_fix() { function twentynineteen_skip_link_focus_fix() {
@ -294,7 +297,6 @@ function twentynineteen_skip_link_focus_fix() {
</script> </script>
<?php <?php
} }
add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' );
/** /**
* Enqueue supplemental block editor styles. * Enqueue supplemental block editor styles.

View File

@ -483,7 +483,10 @@ function twentyseventeen_scripts() {
wp_enqueue_script( 'html5', get_theme_file_uri( '/assets/js/html5.js' ), array(), '20161020' ); wp_enqueue_script( 'html5', get_theme_file_uri( '/assets/js/html5.js' ), array(), '20161020' );
wp_script_add_data( 'html5', 'conditional', 'lt IE 9' ); wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', true ); // Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', true );
wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', true );
$twentyseventeen_l10n = array( $twentyseventeen_l10n = array(
'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ), 'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ),
@ -501,12 +504,10 @@ function twentyseventeen_scripts() {
); );
} }
wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', true ); wp_localize_script( 'twentyseventeen-global', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n );
wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.3', true ); wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.3', true );
wp_localize_script( 'twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
} }

View File

@ -405,7 +405,8 @@ function twentysixteen_scripts() {
wp_enqueue_script( 'twentysixteen-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3' ); wp_enqueue_script( 'twentysixteen-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3' );
wp_script_add_data( 'twentysixteen-html5', 'conditional', 'lt IE 9' ); wp_script_add_data( 'twentysixteen-html5', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'twentysixteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20170530', true ); // Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentysixteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );

View File

@ -1,16 +1,15 @@
/** /**
* Makes "skip to content" link work correctly in IE9, Chrome, and Opera * File skip-link-focus-fix.js.
* for better accessibility.
* *
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ * Helps with accessibility for keyboard only users.
*
* Learn more: https://git.io/vWdr2
*/ */
( function() { ( function() {
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, var isIe = /(trident|msie)/i.test( navigator.userAgent );
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
isIE = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
if ( ( isWebkit || isOpera || isIE ) && document.getElementById && window.addEventListener ) { if ( isIe && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() { window.addEventListener( 'hashchange', function() {
var id = location.hash.substring( 1 ), var id = location.hash.substring( 1 ),
element; element;

View File

@ -314,7 +314,7 @@ function twentythirteen_scripts_styles() {
} }
// Loads JavaScript file with functionality specific to Twenty Thirteen. // Loads JavaScript file with functionality specific to Twenty Thirteen.
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20210122', true ); wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', true );
// Add Source Sans Pro and Bitter fonts, used in the main stylesheet. // Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
$font_version = ( 0 === strpos( (string) twentythirteen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; $font_version = ( 0 === strpos( (string) twentythirteen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;

View File

@ -100,24 +100,6 @@
onResizeARIA(); onResizeARIA();
} ); } );
/**
* Makes "skip to content" link work correctly in IE9 and Chrome for better
* accessibility.
*
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
*/
_window.on( 'hashchange.twentythirteen', function() {
var element = document.getElementById( location.hash.substring( 1 ) );
if ( element ) {
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
element.tabIndex = -1;
}
element.focus();
}
} );
/** /**
* Arranges footer widgets vertically. * Arranges footer widgets vertically.
*/ */

View File

@ -235,6 +235,7 @@ add_action( 'wp_enqueue_scripts', 'twentytwenty_register_scripts' );
* thus it does not warrant having an entire dedicated blocking script being loaded. * thus it does not warrant having an entire dedicated blocking script being loaded.
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* @deprecated Twenty Twenty 2.3 Removed from wp_print_footer_scripts action.
* *
* @link https://git.io/vWdr2 * @link https://git.io/vWdr2
*/ */
@ -246,7 +247,6 @@ function twentytwenty_skip_link_focus_fix() {
</script> </script>
<?php <?php
} }
add_action( 'wp_print_footer_scripts', 'twentytwenty_skip_link_focus_fix' );
/** /**
* Enqueue non-latin language styles. * Enqueue non-latin language styles.

View File

@ -489,6 +489,7 @@ add_action( 'enqueue_block_editor_assets', 'twentytwentyone_block_editor_script'
* thus it does not warrant having an entire dedicated blocking script being loaded. * thus it does not warrant having an entire dedicated blocking script being loaded.
* *
* @since Twenty Twenty-One 1.0 * @since Twenty Twenty-One 1.0
* @deprecated Twenty Twenty-One 1.9 Removed from wp_print_footer_scripts action.
* *
* @link https://git.io/vWdr2 * @link https://git.io/vWdr2
*/ */
@ -508,7 +509,6 @@ function twenty_twenty_one_skip_link_focus_fix() {
<?php <?php
} }
} }
add_action( 'wp_print_footer_scripts', 'twenty_twenty_one_skip_link_focus_fix' );
/** /**
* Enqueue non-latin language styles. * Enqueue non-latin language styles.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-55860'; $wp_version = '6.3-alpha-55861';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.