summaryrefslogtreecommitdiffstatshomepage
path: root/src/js/_enqueues/wp/customize/controls.js
diff options
context:
space:
mode:
authorSergey Biryukov <sergeybiryukov@git.wordpress.org>2021-08-28 01:24:13 +0000
committerSergey Biryukov <sergeybiryukov@git.wordpress.org>2021-08-28 01:24:13 +0000
commit780be4296ab9fc6418b2d3df43be658c2d477c07 (patch)
tree5bcd4355b77deb3b0a2cde0c8c65f05b2fb7b9f6 /src/js/_enqueues/wp/customize/controls.js
parent52fe9ffbd59955c30e1e91ab0ba0f04e72243d8d (diff)
downloadwordpress-780be4296ab9fc6418b2d3df43be658c2d477c07.tar.gz
wordpress-780be4296ab9fc6418b2d3df43be658c2d477c07.zip
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51682 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/js/_enqueues/wp/customize/controls.js')
-rw-r--r--src/js/_enqueues/wp/customize/controls.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/js/_enqueues/wp/customize/controls.js b/src/js/_enqueues/wp/customize/controls.js
index 0496435e42..5656b41687 100644
--- a/src/js/_enqueues/wp/customize/controls.js
+++ b/src/js/_enqueues/wp/customize/controls.js
@@ -8461,6 +8461,13 @@
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.
api.control.each( function( control ) {
if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) {