Skip to content

Commit 89534ba

Browse files
authored
Handle isDraft || isInvalid enter keypress via keydownEvent instead of keyboard shortcut (#51021)
1 parent dc289ea commit 89534ba

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

packages/block-library/src/navigation-link/edit.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
ToolbarButton,
1616
Tooltip,
1717
ToolbarGroup,
18-
KeyboardShortcuts,
1918
} from '@wordpress/components';
2019
import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
2120
import { __ } from '@wordpress/i18n';
@@ -340,7 +339,7 @@ export default function NavigationLinkEdit( {
340339
function onKeyDown( event ) {
341340
if (
342341
isKeyboardEvent.primary( event, 'k' ) ||
343-
( ! url && event.keyCode === ENTER )
342+
( ( ! url || isDraft || isInvalid ) && event.keyCode === ENTER )
344343
) {
345344
setIsLinkOpen( true );
346345
}
@@ -553,13 +552,6 @@ export default function NavigationLinkEdit( {
553552
) }
554553
{ ( isInvalid || isDraft ) && (
555554
<div className="wp-block-navigation-link__placeholder-text wp-block-navigation-link__label">
556-
<KeyboardShortcuts
557-
shortcuts={ {
558-
enter: () =>
559-
isSelected &&
560-
setIsLinkOpen( true ),
561-
} }
562-
/>
563555
<Tooltip
564556
position="top center"
565557
text={ tooltipText }

0 commit comments

Comments
 (0)