Customize: Prevent collapsing expanded panel/section/control when `Esc` is pressed on a block editor instance.

This ensures that the current panel is not collapsed when hitting `Esc` with the focus on the widget block editor.

Follow-up to [37347], [39120].

Props gwwar, dlh.
Fixes #54030.
Built from https://develop.svn.wordpress.org/trunk@51682


git-svn-id: http://core.svn.wordpress.org/trunk@51288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-08-28 01:25:59 +00:00
parent ed0e054f34
commit 79b0d3f3e8
3 changed files with 9 additions and 2 deletions

View File

@ -8461,6 +8461,13 @@
return; return;
} }
// Abort if we're inside of a block editor instance.
if ( event.target.closest( '.block-editor-writing-flow' ) !== null
|| event.target.closest( '.block-editor-block-list__block-popover' ) !== null
) {
return;
}
// Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels. // Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels.
api.control.each( function( control ) { api.control.each( function( control ) {
if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) { if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) {

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.9-alpha-51679'; $wp_version = '5.9-alpha-51682';
/** /**
* 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.