Skip to content

Commit

Permalink
Open link control if submenu parent is link. (#34798)
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines authored Sep 14, 2021
1 parent 839f540 commit a9fd325
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ export default function NavigationSubmenuEdit( {
[ clientId ]
);

// Show the LinkControl on mount if the URL is empty
// ( When adding a new menu item)
// This can't be done in the useState call because it conflicts
// with the autofocus behavior of the BlockListBlock component.
useEffect( () => {
if ( ! openSubmenusOnClick && ! url ) {
setIsLinkOpen( true );
}
}, [] );

// Store the colors from context as attributes for rendering
useEffect( () => {
// This side-effect should not create an undo level as those should
Expand Down

0 comments on commit a9fd325

Please sign in to comment.