WordPress.org

Make WordPress Core

Ticket #42114: 42114.2.diff

File 42114.2.diff, 1.2 KB (added by bpayton, 2 years ago)

Fix to avoid re-animation cases

  • src/wp-admin/js/customize-controls.js

    From d3426f984cd889dc4a11768a70f6705f6ef67cb4 Mon Sep 17 00:00:00 2001
    From: Brandon Payton <brandon@happycode.net>
    Date: Thu, 19 Oct 2017 15:21:31 +0200
    Subject: [PATCH] Avoid re-triggering button highlight
    
    ---
     src/wp-admin/js/customize-controls.js | 10 +++++++---
     1 file changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js
    index 7b275b4d60..5f56043170 100644
    a b  
    786786                        canceled = true;
    787787                }
    788788
    789                 // Remove animation class in case it was already applied.
    790                 button.removeClass( animationClass );
    791 
    792789                params.focusTarget.on( 'focusin', cancelReminder );
    793790                setTimeout( function() {
    794791                        params.focusTarget.off( 'focusin', cancelReminder );
    795792
    796793                        if ( ! canceled ) {
    797794                                button.addClass( animationClass );
     795                                button.one( 'animationend', function () {
     796                                        /*
     797                                        * Remove animation class to avoid situations in Customizer where
     798                                        * DOM nodes are moved (re-inserted) and the animation repeats.
     799                                        */
     800                                        button.removeClass( animationClass );
     801                                } );
    798802                        }
    799803                }, params.delay );
    800804