From cc4bb385fe2fe9e87b9ea81d3419d31511c8d526 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Wed, 8 May 2024 13:40:25 +0530 Subject: [PATCH] [WEB-] chore: trigger command k from input fields and editors (#4362) --- web/components/command-palette/command-palette.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/components/command-palette/command-palette.tsx b/web/components/command-palette/command-palette.tsx index 00de628b7..37056a96f 100644 --- a/web/components/command-palette/command-palette.tsx +++ b/web/components/command-palette/command-palette.tsx @@ -200,6 +200,11 @@ export const CommandPalette: FC = observer(() => { const keyPressed = key.toLowerCase(); const cmdClicked = ctrlKey || metaKey; + + if (cmdClicked && keyPressed === "k" && !isAnyModalOpen) { + e.preventDefault(); + toggleCommandPaletteModal(true); + } // if on input, textarea or editor, don't do anything if ( e.target instanceof HTMLTextAreaElement || @@ -209,10 +214,7 @@ export const CommandPalette: FC = observer(() => { return; if (cmdClicked) { - if (keyPressed === "k") { - e.preventDefault(); - toggleCommandPaletteModal(true); - } else if (keyPressed === "c" && altKey) { + if (keyPressed === "c" && altKey) { e.preventDefault(); copyIssueUrlToClipboard(); } else if (keyPressed === "b") {