Skip to content

Commit

Permalink
Need to close the menu after some actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jun 15, 2023
1 parent 5c7a933 commit d1ea5c6
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,21 @@ function GlobalStylesActionMenu() {
return (
<GlobalStylesMenuFill>
<DropdownMenu icon={ moreVertical } label={ __( 'More' ) }>
{ () => (
{ ( { onClose } ) => (
<MenuGroup>
{ canEditCSS && (
<MenuItem onClick={ loadCustomCSS }>
{ __( 'Additional CSS' ) }
</MenuItem>
) }
<MenuItem
onClick={ () =>
toggle( 'core/edit-site', 'welcomeGuideStyles' )
}
onClick={ () => {
toggle(
'core/edit-site',
'welcomeGuideStyles'
);
onClose();
} }
>
{ __( 'Welcome Guide' ) }
</MenuItem>
Expand Down Expand Up @@ -137,7 +141,7 @@ function GlobalStylesRevisionsMenu() {
return (
<GlobalStylesMenuFill>
<DropdownMenu icon={ backup } label={ __( 'Revisions' ) }>
{ () => (
{ ( { onClose } ) => (
<MenuGroup>
{ hasRevisions && (
<MenuItem
Expand All @@ -151,7 +155,13 @@ function GlobalStylesRevisionsMenu() {
{ __( 'Revision history' ) }
</MenuItem>
) }
<MenuItem onClick={ onReset } disabled={ ! canReset }>
<MenuItem
onClick={ () => {
onReset();
onClose();
} }
disabled={ ! canReset }
>
{ __( 'Reset to defaults' ) }
</MenuItem>
</MenuGroup>
Expand Down

0 comments on commit d1ea5c6

Please sign in to comment.