diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index 9cd39c96f6..893dd42232 100644 --- a/src/wp-admin/js/customize-nav-menus.js +++ b/src/wp-admin/js/customize-nav-menus.js @@ -2852,7 +2852,7 @@ var insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {}; _( data.nav_menu_updates ).each(function( update ) { - var oldCustomizeId, newCustomizeId, customizeId, oldSetting, newSetting, setting, settingValue, oldSection, newSection, wasSaved, widgetTemplate, navMenuCount; + var oldCustomizeId, newCustomizeId, customizeId, oldSetting, newSetting, setting, settingValue, oldSection, newSection, wasSaved, widgetTemplate, navMenuCount, shouldExpandNewSection; if ( 'inserted' === update.status ) { if ( ! update.previous_term_id ) { throw new Error( 'Expected previous_term_id' ); @@ -2884,7 +2884,8 @@ previewer: api.previewer } ); - if ( oldSection.expanded() ) { + shouldExpandNewSection = oldSection.expanded(); + if ( shouldExpandNewSection ) { oldSection.collapse(); } @@ -2959,8 +2960,7 @@ } } ); - if ( oldSection.expanded.get() ) { - // @todo This doesn't seem to be working. + if ( shouldExpandNewSection ) { newSection.expand(); } } else if ( 'updated' === update.status ) {