diff --git a/packages/block-editor/src/components/provider/index.js b/packages/block-editor/src/components/provider/index.js index 0fa3f042053d08..c3a87dfb5ff004 100644 --- a/packages/block-editor/src/components/provider/index.js +++ b/packages/block-editor/src/components/provider/index.js @@ -45,7 +45,7 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider( useBlockSync( props ); return ( - + { children } diff --git a/packages/components/src/slot-fill/index.tsx b/packages/components/src/slot-fill/index.tsx index fb1a08bc2207f9..b2df054973a5ba 100644 --- a/packages/components/src/slot-fill/index.tsx +++ b/packages/components/src/slot-fill/index.tsx @@ -55,9 +55,12 @@ export function UnforwardedSlot( } export const Slot = forwardRef( UnforwardedSlot ); -export function Provider( { children }: SlotFillProviderProps ) { +export function Provider( { + children, + passthrough = false, +}: SlotFillProviderProps ) { const parent = useContext( SlotFillContext ); - if ( ! parent.isDefault ) { + if ( ! parent.isDefault && passthrough ) { return <>{ children }; } return ( diff --git a/packages/components/src/slot-fill/types.ts b/packages/components/src/slot-fill/types.ts index 8abb9b941c527c..f3a8f2255f2874 100644 --- a/packages/components/src/slot-fill/types.ts +++ b/packages/components/src/slot-fill/types.ts @@ -96,6 +96,11 @@ export type SlotFillProviderProps = { * The children elements. */ children: ReactNode; + + /** + * Whether to pass slots to the parent provider if existent. + */ + passthrough?: boolean; }; export type SlotFillBubblesVirtuallySlotRef = RefObject< HTMLElement >;