Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Fix: close button is not working
  • Loading branch information
parthVataliya16 committed Sep 18, 2024
commit 30990f8bc12a70f91d85e7bc3052a3be69361a6b
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/**
* WordPress dependencies
*/
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 { useCallback, useRef } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -28,7 +25,6 @@ export default function InserterSidebar() {
return setIsInserterOpened( false );
}, [ setIsInserterOpened ] );

const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
onClose: closeInserter,
focusOnMount: true,
Expand All @@ -42,21 +38,14 @@ export default function InserterSidebar() {
{ ...inserterDialogProps }
className="edit-widgets-layout__inserter-panel"
>
<TagName className="edit-widgets-layout__inserter-panel-header">
<Button
__next40pxDefaultSize
icon={ close }
onClick={ closeInserter }
label={ __( 'Close block inserter' ) }
/>
</TagName>
<div className="edit-widgets-layout__inserter-panel-content">
<Library
showInserterHelpPanel
shouldFocusBlock={ isMobileViewport }
rootClientId={ rootClientId }
__experimentalInsertionIndex={ insertionIndex }
ref={ libraryRef }
onClose={ closeInserter }
/>
</div>
</div>
Expand Down