Customize: Fix focusing on controls for widgets and nav menu items after [38648].
Shift-click on nav menu items was not expanding the nav menu section, and shift-clicking on widgets would not always result in focus being added to an element in the control's container. See #34391. git-svn-id: https://develop.svn.wordpress.org/trunk@38668 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
81ecd4da98
commit
c286c27747
@ -1529,7 +1529,6 @@
|
||||
*/
|
||||
expandControlSection: function() {
|
||||
var $section = this.container.closest( '.accordion-section' );
|
||||
|
||||
if ( ! $section.hasClass( 'open' ) ) {
|
||||
$section.find( '.accordion-section-title:first' ).trigger( 'click' );
|
||||
}
|
||||
@ -1683,8 +1682,9 @@
|
||||
*/
|
||||
focus: function( params ) {
|
||||
params = params || {};
|
||||
var control = this, originalCompleteCallback = params.completeCallback;
|
||||
var control = this, originalCompleteCallback = params.completeCallback, focusControl;
|
||||
|
||||
focusControl = function() {
|
||||
control.expandControlSection();
|
||||
|
||||
params.completeCallback = function() {
|
||||
@ -1700,6 +1700,15 @@
|
||||
};
|
||||
|
||||
control.expandForm( params );
|
||||
};
|
||||
|
||||
if ( api.section.has( control.section() ) ) {
|
||||
api.section( control.section() ).expand( {
|
||||
completeCallback: focusControl
|
||||
} );
|
||||
} else {
|
||||
focusControl();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -2955,7 +2964,6 @@
|
||||
*/
|
||||
api.Menus.focusMenuItemControl = function( menuItemId ) {
|
||||
var control = api.Menus.getMenuItemControl( menuItemId );
|
||||
|
||||
if ( control ) {
|
||||
control.focus();
|
||||
}
|
||||
|
@ -1325,7 +1325,7 @@
|
||||
* @param {Object} args merged on top of this.defaultActiveArguments
|
||||
*/
|
||||
onChangeExpanded: function ( expanded, args ) {
|
||||
var self = this, $widget, $inside, complete, prevComplete;
|
||||
var self = this, $widget, $inside, complete, prevComplete, expandControl;
|
||||
|
||||
self.embedWidgetControl(); // Make sure the outer form is embedded so that the expanded state can be set in the UI.
|
||||
if ( expanded ) {
|
||||
@ -1345,11 +1345,7 @@
|
||||
$widget = this.container.find( 'div.widget:first' );
|
||||
$inside = $widget.find( '.widget-inside:first' );
|
||||
|
||||
if ( expanded ) {
|
||||
|
||||
if ( self.section() && api.section( self.section() ) ) {
|
||||
self.expandControlSection();
|
||||
}
|
||||
expandControl = function() {
|
||||
|
||||
// Close all other widget controls before expanding this one
|
||||
api.control.each( function( otherControl ) {
|
||||
@ -1379,6 +1375,16 @@
|
||||
|
||||
self.container.trigger( 'expand' );
|
||||
self.container.addClass( 'expanding' );
|
||||
};
|
||||
|
||||
if ( expanded ) {
|
||||
if ( api.section.has( self.section() ) ) {
|
||||
api.section( self.section() ).expand( {
|
||||
completeCallback: expandControl
|
||||
} );
|
||||
} else {
|
||||
expandControl();
|
||||
}
|
||||
} else {
|
||||
|
||||
complete = function() {
|
||||
|
Loading…
Reference in New Issue
Block a user