Customize: Fix focus and autofocus on `nav_menu_item` controls.
Embed the `nav_menu_item` control not only when the contained `nav_menu` section expands, but also if the control was autofocused (via the `autofocus[control]` query param). Also applies change from [33596] to work-around a broken `:focusable` selector in jQuery UI. See #33258. Fixes #34629. git-svn-id: https://develop.svn.wordpress.org/trunk@35584 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0e39b86500
commit
01b19a6345
|
@ -1012,7 +1012,7 @@
|
|||
return;
|
||||
}
|
||||
section = api.section( sectionId );
|
||||
if ( section && section.expanded() ) {
|
||||
if ( ( section && section.expanded() ) || api.settings.autofocus.control === control.id ) {
|
||||
control.actuallyEmbed();
|
||||
}
|
||||
},
|
||||
|
@ -1433,9 +1433,12 @@
|
|||
* the first input in the control.
|
||||
*/
|
||||
focus: function() {
|
||||
this.expandControlSection();
|
||||
this.expandForm();
|
||||
this.container.find( '.menu-item-settings :focusable:first' ).focus();
|
||||
var control = this, focusable;
|
||||
control.expandControlSection();
|
||||
control.expandForm();
|
||||
// Note that we can't use :focusable due to a jQuery UI issue. See: https://github.com/jquery/jquery-ui/pull/1583
|
||||
focusable = control.container.find( '.menu-item-settings' ).find( 'input, select, textarea, button, object, a[href], [tabindex]' ).filter( ':visible' );
|
||||
focusable.first().focus();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue