Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty secondary sidebar overlapping widget editor content on mobile viewports #38017

Merged
merged 2 commits into from
Jan 17, 2022
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
36 changes: 36 additions & 0 deletions packages/e2e-tests/specs/widgets/editing-widgets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
openGlobalBlockInserter,
searchForBlock,
closeGlobalBlockInserter,
setBrowserViewport,
} from '@wordpress/e2e-test-utils';

/**
Expand Down Expand Up @@ -842,6 +843,41 @@ describe( 'Widgets screen', () => {
expect( listItems.length >= widgetAreas.length ).toEqual( true );
await closeListView();
} );

// Check for regressions of https://github.com/WordPress/gutenberg/issues/38002.
it( 'allows blocks to be added on mobile viewports', async () => {
await setBrowserViewport( 'small' );
const [ firstWidgetArea ] = await findAll( {
role: 'document',
name: 'Block: Widget Area',
} );

const addParagraphBlock = await getBlockInGlobalInserter( 'Paragraph' );
await addParagraphBlock.click();

const addedParagraphBlockInFirstWidgetArea = await find(
{
name: /^Empty block/,
selector: '[data-block][data-type="core/paragraph"]',
},
{
root: firstWidgetArea,
}
);
await addedParagraphBlockInFirstWidgetArea.focus();
await page.keyboard.type( 'First Paragraph' );
const updatedParagraphBlockInFirstWidgetArea = await find(
{
name: 'Paragraph block',
value: 'First Paragraph',
},
{
root: firstWidgetArea,
}
);

expect( updatedParagraphBlockInFirstWidgetArea ).toBeTruthy();
} );
} );

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-widgets/src/components/layout/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ function Interface( { blockEditorSettings } ) {
}
}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );

const hasSecondarySidebar = isListViewOpened || isInserterOpened;

return (
<InterfaceSkeleton
labels={ interfaceLabels }
header={ <Header /> }
secondarySidebar={ <SecondarySidebar /> }
secondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }
sidebar={
hasSidebarEnabled && (
<ComplementaryArea.Slot scope="core/edit-widgets" />
Expand Down