Skip to content

Commit

Permalink
Widget Editor: Don't close the inserter when focusing outside it
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Dec 11, 2024
1 parent b658230 commit 29a9ecf
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import { Button, VisuallyHidden } from '@wordpress/components';
import { close } from '@wordpress/icons';
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
import {
useViewportMatch,
__experimentalUseDialog as useDialog,
} from '@wordpress/compose';
import { useViewportMatch } from '@wordpress/compose';
import { useCallback, useRef } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
Expand All @@ -29,19 +26,11 @@ export default function InserterSidebar() {
}, [ setIsInserterOpened ] );

const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
onClose: closeInserter,
focusOnMount: true,
} );

const libraryRef = useRef();

return (
<div
ref={ inserterDialogRef }
{ ...inserterDialogProps }
className="edit-widgets-layout__inserter-panel"
>
<div className="edit-widgets-layout__inserter-panel">
<TagName className="edit-widgets-layout__inserter-panel-header">
<Button
__next40pxDefaultSize
Expand Down

0 comments on commit 29a9ecf

Please sign in to comment.