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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2020-07-13 20:15:06 +00:00
parent c7617838b1
commit ac2a1c341d
5 changed files with 11 additions and 12 deletions

View File

@ -216,9 +216,9 @@
} }
} ); } );
// Clear the search results and trigger a `keyup` event to fire a new search. // Clear the search results and trigger an `input` event to fire a new search.
this.$clearResults.on( 'click', function() { this.$clearResults.on( 'click', function() {
self.$search.val( '' ).focus().trigger( 'keyup' ); self.$search.val( '' ).focus().trigger( 'input' );
} ); } );
this.$el.on( 'input', '#custom-menu-item-name.invalid, #custom-menu-item-url.invalid', function() { this.$el.on( 'input', '#custom-menu-item-name.invalid, #custom-menu-item-url.invalid', function() {
@ -733,7 +733,7 @@
$( 'body' ).removeClass( 'adding-menu-items' ); $( 'body' ).removeClass( 'adding-menu-items' );
$( '#available-menu-items .menu-item-handle.item-added' ).removeClass( 'item-added' ); $( '#available-menu-items .menu-item-handle.item-added' ).removeClass( 'item-added' );
this.$search.val( '' ).trigger( 'keyup' ); this.$search.val( '' ).trigger( 'input' );
}, },
// Add a few keyboard enhancements to the panel. // Add a few keyboard enhancements to the panel.

File diff suppressed because one or more lines are too long

View File

@ -193,10 +193,9 @@
} }
} ); } );
// Clear the search results and trigger a new search. // Clear the search results and trigger an `input` event to fire a new search.
this.$clearResults.on( 'click', function() { this.$clearResults.on( 'click', function() {
self.$search.val( '' ).focus(); self.$search.val( '' ).focus().trigger( 'input' );
self.collection.doSearch( '' );
} ); } );
// Close the panel if the URL in the preview changes. // Close the panel if the URL in the preview changes.
@ -385,7 +384,7 @@
$( 'body' ).removeClass( 'adding-widget' ); $( 'body' ).removeClass( 'adding-widget' );
this.$search.val( '' ); this.$search.val( '' ).trigger( 'input' );
}, },
/** /**

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta1-48460'; $wp_version = '5.5-beta1-48461';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.