diff --git a/packages/block-editor/src/components/duotone-control/style.scss b/packages/block-editor/src/components/duotone-control/style.scss
index 133f0e0b8a7489..61d0b30c0a2f29 100644
--- a/packages/block-editor/src/components/duotone-control/style.scss
+++ b/packages/block-editor/src/components/duotone-control/style.scss
@@ -11,6 +11,7 @@
.components-menu-group__label {
padding: $grid-unit-15 $grid-unit-15 0 $grid-unit-15;
width: 100%;
+ box-sizing: border-box;
}
}
diff --git a/packages/customize-widgets/src/components/customize-widgets/index.js b/packages/customize-widgets/src/components/customize-widgets/index.js
index ef86c44f5a3740..35a91cb89de668 100644
--- a/packages/customize-widgets/src/components/customize-widgets/index.js
+++ b/packages/customize-widgets/src/components/customize-widgets/index.js
@@ -57,7 +57,7 @@ export default function CustomizeWidgets( {
const popover =
parentContainer &&
createPortal(
-
+
,
parentContainer
diff --git a/packages/customize-widgets/src/components/customize-widgets/use-clear-selected-block.js b/packages/customize-widgets/src/components/customize-widgets/use-clear-selected-block.js
index b4e31950e8b38b..7de8d775213234 100644
--- a/packages/customize-widgets/src/components/customize-widgets/use-clear-selected-block.js
+++ b/packages/customize-widgets/src/components/customize-widgets/use-clear-selected-block.js
@@ -10,6 +10,13 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
* many root nodes rather than just one in the post editor.
* We need to listen to the focus events in all those roots, and also in
* the preview iframe.
+ * This hook will clear the selected block when focusing outside the editor,
+ * with a few exceptions:
+ * 1. Focusing on popovers.
+ * 2. Focusing on the inspector.
+ * 3. Focusing on any modals/dialogs.
+ * These cases are normally triggered by user interactions from the editor,
+ * not by explicitly focusing outside the editor, hence no need for clearing.
*
* @param {Object} sidebarControl The sidebar control instance.
* @param {Object} popoverRef The ref object of the popover node container.
@@ -38,7 +45,8 @@ export default function useClearSelectedBlock( sidebarControl, popoverRef ) {
// 3. It should also not exist in the container, inspector, nor the popover.
! container.contains( element ) &&
! popoverRef.current.contains( element ) &&
- ! inspectorContainer.contains( element )
+ ! inspectorContainer.contains( element ) &&
+ ! element.closest( '[role="dialog"]' )
) {
clearSelectedBlock();
}
diff --git a/packages/customize-widgets/src/style.scss b/packages/customize-widgets/src/style.scss
index 5fca995e322c57..50890940e24045 100644
--- a/packages/customize-widgets/src/style.scss
+++ b/packages/customize-widgets/src/style.scss
@@ -11,3 +11,10 @@
.components-modal__screen-overlay {
z-index: 999999;
}
+
+// Include reset CSS for the customizer.
+.customize-control-sidebar_block_editor,
+.customize-widgets-layout__inspector,
+.customize-widgets-popover {
+ @include reset;
+}