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.

Built from https://develop.svn.wordpress.org/trunk@35584


git-svn-id: http://core.svn.wordpress.org/trunk@35548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-11-09 03:14:25 +00:00
parent 1032bc6775
commit f4659f7ee0
3 changed files with 10 additions and 7 deletions

View File

@ -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();
},
/**

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta3-35583';
$wp_version = '4.4-beta3-35584';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.