Make WordPress Core

Ticket #34344: 34344.diff

File 34344.diff, 2.0 KB (added by westonruter, 9 years ago)
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index e78d2c9..ad15088 100644
     
    300300                 * @param {Object}  args.completeCallback
    301301                 */
    302302                onChangeActive: function( active, args ) {
    303                         var duration, construct = this, expandedOtherPanel;
     303                        var duration, construct = this, expandedOtherConstructs = [];
    304304                        if ( args.unchanged ) {
    305305                                if ( args.completeCallback ) {
    306306                                        args.completeCallback();
     
    310310
    311311                        duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 );
    312312
     313                        // If this is a panel/section is not currently expanded but another is expanded, do not animate.
    313314                        if ( construct.extended( api.Panel ) ) {
    314                                 // If this is a panel is not currently expanded but another panel is expanded, do not animate.
    315315                                api.panel.each(function ( panel ) {
    316316                                        if ( panel !== construct && panel.expanded() ) {
    317                                                 expandedOtherPanel = panel;
    318                                                 duration = 0;
     317                                                expandedOtherConstructs.push( panel );
    319318                                        }
    320319                                });
     320                        }
     321                        if ( construct.extended( api.Section ) ) {
     322                                api.section.each(function ( section ) {
     323                                        if ( section !== construct && section.expanded() ) {
     324                                                expandedOtherConstructs.push( section );
     325                                        }
     326                                });
     327                        }
    321328
     329                        if ( expandedOtherConstructs.length ) {
     330                                duration = 0;
     331                        }
     332
     333                        if ( construct.extended( api.Panel ) ) {
    322334                                // Collapse any expanded sections inside of this panel first before deactivating.
    323335                                if ( ! active ) {
    324336                                        _.each( construct.sections(), function( section ) {
     
    349361                        }
    350362
    351363                        // Recalculate the margin-top immediately, not waiting for debounced reflow, to prevent momentary (100ms) vertical jiggle.
    352                         if ( expandedOtherPanel ) {
    353                                 expandedOtherPanel._recalculateTopMargin();
    354                         }
     364                        _.each( expandedOtherConstructs, function( expandedOtherConstruct ) {
     365                                expandedOtherConstruct._recalculateTopMargin();
     366                        });
    355367                },
    356368
    357369                /**