Make WordPress Core

Changeset 48461


Ignore:
Timestamp:
07/13/2020 08:13:49 PM (4 years ago)
Author:
whyisjake
Message:

Customize: Ensure that widgets and nav-menus can be closed after entering content.

Previously, the ⌧ button would close the search panel, or remove the results. This restores that, in addition pressing escape will do the same.

Fixes #48198.

Props garrett-eclipse, tobifjellner, afercia, JavierCasares.

Location:
trunk/src/js/_enqueues/wp/customize
Files:
2 edited

Legend:

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

    r47356 r48461  
    217217            } );
    218218
    219             // Clear the search results and trigger a `keyup` event to fire a new search.
     219            // Clear the search results and trigger an `input` event to fire a new search.
    220220            this.$clearResults.on( 'click', function() {
    221                 self.$search.val( '' ).focus().trigger( 'keyup' );
     221                self.$search.val( '' ).focus().trigger( 'input' );
    222222            } );
    223223
     
    734734            $( '#available-menu-items .menu-item-handle.item-added' ).removeClass( 'item-added' );
    735735
    736             this.$search.val( '' ).trigger( 'keyup' );
     736            this.$search.val( '' ).trigger( 'input' );
    737737        },
    738738
     
    18201820                 * If the menu item deleted is the only of its instance left,
    18211821                 * remove the check icon of this menu item in the right panel.
    1822                  */ 
     1822                 */
    18231823                _.each( addedItems, function( addedItem ) {
    18241824                    var menuItemId, menuItemControl, matches;
    1825                        
     1825
    18261826                    // This is because menu item that's deleted is just hidden.
    18271827                    if ( ! $( addedItem ).is( ':visible' ) ) {
  • trunk/src/js/_enqueues/wp/customize/widgets.js

    r47233 r48461  
    194194            } );
    195195
    196             // Clear the search results and trigger a new search.
     196            // Clear the search results and trigger an `input` event to fire a new search.
    197197            this.$clearResults.on( 'click', function() {
    198                 self.$search.val( '' ).focus();
    199                 self.collection.doSearch( '' );
     198                self.$search.val( '' ).focus().trigger( 'input' );
    200199            } );
    201200
     
    386385            $( 'body' ).removeClass( 'adding-widget' );
    387386
    388             this.$search.val( '' );
     387            this.$search.val( '' ).trigger( 'input' );
    389388        },
    390389
Note: See TracChangeset for help on using the changeset viewer.