Make WordPress Core

Ticket #59689: 59689.2.diff

File 59689.2.diff, 2.2 KB (added by bplv, 2 years ago)

Patch-2

  • src/js/_enqueues/admin/common.js

    diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js
    index e3daa8c4d1..38eddf0207 100644
    a b $( function() { 
    17331733                                                setTimeout( function() {
    17341734                                                        var focusIsInToggle  = $.contains( toggleButton, focusedElement );
    17351735                                                        var focusIsInSidebar = $.contains( sidebar, focusedElement );
    1736                                                        
     1736
    17371737                                                        if ( ! focusIsInToggle && ! focusIsInSidebar ) {
    17381738                                                                $( toggleButton ).trigger( 'click.wp-responsive' );
    17391739                                                        }
    $( function( $ ) { 
    21292129/**
    21302130 * Freeze animated plugin icons when reduced motion is enabled.
    21312131 *
    2132  * When the user has enabled the 'prefers-reduced-motion' setting, this module 
    2133  * stops animations for all GIFs on the page with the class 'plugin-icon' or 
     2132 * When the user has enabled the 'prefers-reduced-motion' setting, this module
     2133 * stops animations for all GIFs on the page with the class 'plugin-icon' or
    21342134 * plugin icon images in the update plugins table.
    21352135 *
    21362136 * @since 6.4.0
    $( function( $ ) { 
    21392139        // Private variables and methods.
    21402140        var priv = {},
    21412141                pub = {},
     2142                $body = $( document.body ),
    21422143                mediaQuery;
    21432144
    21442145        // Initialize pauseAll to false; it will be set to true if reduced motion is preferred.
    $( function( $ ) { 
    21562157                        var width = img.width;
    21572158                        var height = img.height;
    21582159                        var canvas = document.createElement( 'canvas' );
    2159                        
     2160
    21602161                        // Set canvas dimensions.
    21612162                        canvas.width = width;
    21622163                        canvas.height = height;
    $( function( $ ) { 
    22202221        // Listen for jQuery AJAX events.
    22212222        ( function( $ ) {
    22222223                $( document ).ajaxComplete( function( event, xhr, settings ) {
     2224
     2225                        // Return early if this is not the plugin-install.php page.
     2226                        if ( ! body.hasClass( 'plugin-install-php' ) ) {
     2227                                return;
     2228                        }
     2229
    22232230                        // Check if this is the 'search-install-plugins' request.
    2224                         if ( settings.data && settings.data.includes( 'action=search-install-plugins' ) ) {
     2231                        if ( settings.data && typeof settings.data === "string" && settings.data.includes( 'action=search-install-plugins' ) ) {
    22252232                                // Recheck if the user prefers reduced motion.
    22262233                                if ( window.matchMedia ) {
    22272234                                        var mediaQuery = window.matchMedia( '(prefers-reduced-motion: reduce)' );