diff --git a/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js b/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js
deleted file mode 100644
index e450ab8b0d4073..00000000000000
--- a/packages/block-editor/src/components/inspector-controls/block-support-slot-container.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';
-import { useContext } from '@wordpress/element';
-
-export default function BlockSupportSlotContainer( { Slot, ...props } ) {
- const toolsPanelContext = useContext( ToolsPanelContext );
- return ;
-}
diff --git a/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js b/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js
index 450a8351de8e32..411b827259d032 100644
--- a/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js
+++ b/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js
@@ -10,7 +10,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { store as blockEditorStore } from '../../store';
import { cleanEmptyObject } from '../../hooks/utils';
-export default function BlockSupportToolsPanel( { children, label, header } ) {
+export default function BlockSupportToolsPanel( { children, label } ) {
const { clientId, attributes } = useSelect( ( select ) => {
const { getBlockAttributes, getSelectedBlockClientId } = select(
blockEditorStore
@@ -47,7 +47,6 @@ export default function BlockSupportToolsPanel( { children, label, header } ) {
return (
{ ( fillProps ) => {
- // Children passed to InspectorControlsFill will not have
- // access to any React Context whose Provider is part of
- // the InspectorControlsSlot tree. So we re-create the
- // Provider in this subtree.
- const value = ! isEmpty( fillProps ) ? fillProps : null;
+ // Check if the fills here represent the contents of a
+ // block support panel and require a wrapping ToolsPanel.
+ const { label } = fillProps;
+
+ if ( ! label ) {
+ return children;
+ }
+
return (
-
+
{ children }
-
+
);
} }
diff --git a/packages/block-editor/src/components/inspector-controls/slot.js b/packages/block-editor/src/components/inspector-controls/slot.js
index c9da21817103d3..58a02c72e687f7 100644
--- a/packages/block-editor/src/components/inspector-controls/slot.js
+++ b/packages/block-editor/src/components/inspector-controls/slot.js
@@ -7,8 +7,6 @@ import warning from '@wordpress/warning';
/**
* Internal dependencies
*/
-import BlockSupportToolsPanel from './block-support-tools-panel';
-import BlockSupportSlotContainer from './block-support-slot-container';
import groups from './groups';
export default function InspectorControlsSlot( {
@@ -30,14 +28,15 @@ export default function InspectorControlsSlot( {
}
if ( label ) {
+ // Slots for block support panels will include a label for the panel
+ // header. This is passed through the fillProps to indicate when the
+ // fills require a wrapping ToolsPanel.
return (
-
-
-
+
);
}