Skip to content

Commit

Permalink
Inserter: Don't close when inserting (#61004)
Browse files Browse the repository at this point in the history
* Zoomed Out View: Don't close the inserter

Co-authored-by: scruffian <[email protected]>
Co-authored-by: jeryj <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ellatrix <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: getdave <[email protected]>
  • Loading branch information
9 people authored May 8, 2024
1 parent 3997457 commit e9981aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
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

0 comments on commit e9981aa

Please sign in to comment.