Make WordPress Core

Changeset 35584


Ignore:
Timestamp:
11/09/2015 03:13:09 AM (11 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-nav-menus.js

    r35581 r35584  
    10131013                        }
    10141014                        section = api.section( sectionId );
    1015                         if ( section && section.expanded() ) {
     1015                        if ( ( section && section.expanded() ) || api.settings.autofocus.control === control.id ) {
    10161016                                control.actuallyEmbed();
    10171017                        }
    … …  
    14341434                 */
    14351435                focus: function() {
    1436                         this.expandControlSection();
    1437                         this.expandForm();
    1438                         this.container.find( '.menu-item-settings :focusable:first' ).focus();
     1436                        var control = this, focusable;
     1437                        control.expandControlSection();
     1438                        control.expandForm();
     1439                        // Note that we can't use :focusable due to a jQuery UI issue. See: https://github.com/jquery/jquery-ui/pull/1583
     1440                        focusable = control.container.find( '.menu-item-settings' ).find( 'input, select, textarea, button, object, a[href], [tabindex]' ).filter( ':visible' );
     1441                        focusable.first().focus();
    14391442                },
    14401443
Note: See TracChangeset for help on using the changeset viewer.