Skip to content

Commit

Permalink
Prevent default on primary+k to prevent command center from opening (#…
Browse files Browse the repository at this point in the history
…59845)

The command center shortcut checks for defaultPrevented to see if it should open or not. To prevent the command center from opening, we need to add event.preventDefault when primary+k is used.
  • Loading branch information
jeryj authored and youknowriad committed Mar 18, 2024
1 parent f9c196d commit 31ac517
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export default function NavigationLinkEdit( {
isKeyboardEvent.primary( event, 'k' ) ||
( ( ! url || isDraft || isInvalid ) && event.keyCode === ENTER )
) {
event.preventDefault();
setIsLinkOpen( true );
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export default function NavigationSubmenuEdit( {

function onKeyDown( event ) {
if ( isKeyboardEvent.primary( event, 'k' ) ) {
event.preventDefault();
setIsLinkOpen( true );
}
}
Expand Down

0 comments on commit 31ac517

Please sign in to comment.