Skip to content

Commit

Permalink
Open link ui when added
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Jones authored and Jeremy Jones committed Dec 20, 2024
1 parent 01d0e68 commit 7ad1633
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ export default function NavigationLinkEdit( {
selectBlock,
selectPreviousBlock,
} = useDispatch( blockEditorStore );
// Have the link editing ui open on mount when lacking a url and selected.
const [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );
// Have the link editing ui open on mount if the block was just added.
const [ isLinkOpen, setIsLinkOpen ] = useState( isSelected );
// Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
Expand Down Expand Up @@ -298,6 +298,7 @@ export default function NavigationLinkEdit( {
},
[ clientId, maxNestingLevel ]
);

const { getBlocks } = useSelect( blockEditorStore );

/**
Expand Down

0 comments on commit 7ad1633

Please sign in to comment.