Customize: Collapse available nav menu items panel when clicking outside over preview or over existing items.

Props rockwell15.
Fixes #38953.


git-svn-id: https://develop.svn.wordpress.org/trunk@39548 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-12-09 06:15:15 +00:00
parent 3669b47260
commit 3caac42ac0
2 changed files with 13 additions and 0 deletions

View File

@ -719,6 +719,10 @@ body.adding-menu-items #customize-preview {
opacity: 0.4;
}
body.adding-menu-items #customize-preview iframe {
pointer-events: none;
}
.menu-item-handle .spinner {
display: none;
float: left;

View File

@ -665,12 +665,20 @@
// Opens the panel.
open: function( menuControl ) {
var panel = this, close;
this.currentMenuControl = menuControl;
this.itemSectionHeight();
$( 'body' ).addClass( 'adding-menu-items' );
close = function() {
panel.close();
$( this ).off( 'click', close );
};
$( '#customize-preview' ).on( 'click', close );
// Collapse all controls.
_( this.currentMenuControl.getMenuItemControls() ).each( function( control ) {
control.collapseForm();
@ -1319,6 +1327,7 @@
this.container.find( '.menu-item-handle' ).on( 'click', function( e ) {
e.preventDefault();
e.stopPropagation();
api.Menus.availableMenuItemsPanel.close();
var menuControl = control.getMenuControl();
if ( menuControl.isReordering || menuControl.isSorting ) {
return;