Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
useBlockSync( props );

return (
<SlotFillProvider>
<SlotFillProvider passthrough>
<KeyboardShortcuts.Register />
<BlockRefsProvider>{ children }</BlockRefsProvider>
</SlotFillProvider>
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- `ToggleGroupControl`: react correctly to external controlled updates ([#56678](https://github.com/WordPress/gutenberg/pull/56678)).
- `ToolsPanel`: fix a performance issue ([#56770](https://github.com/WordPress/gutenberg/pull/56770)).
- `BorderControl`: adjust `BorderControlDropdown` Button size to fix misaligned border ([#56730](https://github.com/WordPress/gutenberg/pull/56730)).
- `SlotFillProvider`: Restore contextual Slot/Fills within SlotFillProvider ([#56779](https://github.com/WordPress/gutenberg/pull/56779)).

### Internal

Expand Down
7 changes: 5 additions & 2 deletions packages/components/src/slot-fill/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/slot-fill/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 >;
Expand Down