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

Zoomed Out View: Don't close the inserter #61004

Merged
merged 2 commits into from
May 8, 2024
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
16 changes: 2 additions & 14 deletions packages/editor/src/components/inserter-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { Button } from '@wordpress/components';
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
import { closeSmall } from '@wordpress/icons';
import {
useViewportMatch,
__experimentalUseDialog as useDialog,
} from '@wordpress/compose';
import { useViewportMatch } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import { useRef } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';
Expand All @@ -34,19 +31,10 @@ export default function InserterSidebar( {
const { setIsInserterOpened } = useDispatch( editorStore );

const isMobileViewport = useViewportMatch( 'medium', '<' );
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
onClose: () => setIsInserterOpened( false ),
focusOnMount: true,
} );

const libraryRef = useRef();

return (
<div
ref={ inserterDialogRef }
{ ...inserterDialogProps }
className="editor-inserter-sidebar"
>
<div className="editor-inserter-sidebar">
<div className="editor-inserter-sidebar__header">
<Button
className="editor-inserter-sidebar__close-button"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/inserting-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,15 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {
.click();
await page.getByRole( 'option', { name: 'More', exact: true } ).click();

// Moving focus to the More block should close the inserter.
// Moving focus to the More block should not close the inserter.
await editor.canvas
.getByRole( 'textbox', { name: 'Read more' } )
.fill( 'More' );
await expect(
page.getByRole( 'region', {
name: 'Block Library',
} )
).toBeHidden();
).toBeVisible();
} );

test( 'shows block preview when hovering over block in inserter', async ( {
Expand Down
Loading