Skip to content

Commit

Permalink
Block Library: Handle Popover onClose for LinkControl
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 24, 2020
1 parent 361d2df commit 24961ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ function URLPicker( { isSelected, url, title, setAttributes, opensInNewTab, onTo
setIsURLPickerOpen( true );
};
const linkControl = isURLPickerOpen && (
<Popover position="bottom center">
<Popover
position="bottom center"
onClose={ () => setIsURLPickerOpen( false ) }
>
<LinkControl
className="wp-block-navigation-link__inline-link-input"
value={ { url, title, opensInNewTab } }
Expand All @@ -111,9 +114,6 @@ function URLPicker( { isSelected, url, title, setAttributes, opensInNewTab, onTo
onToggleOpenInNewTab( newOpensInNewTab );
}
} }
onClose={ () => {
setIsURLPickerOpen( false );
} }
/>
</Popover>
);
Expand Down
6 changes: 4 additions & 2 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ function NavigationLinkEdit( {
</span>
}
{ isLinkOpen && (
<Popover position="bottom center">
<Popover
position="bottom center"
onClose={ () => setIsLinkOpen( false ) }
>
<LinkControl
className="wp-block-navigation-link__inline-link-input"
value={ link }
Expand All @@ -202,7 +205,6 @@ function NavigationLinkEdit( {
opensInNewTab: newOpensInNewTab,
id,
} ) }
onClose={ () => setIsLinkOpen( false ) }
/>
</Popover>
) }
Expand Down

0 comments on commit 24961ae

Please sign in to comment.