fix(ui): the command palette opens on Ctrl+K only

This commit is contained in:
sam committed 2026-11-13 13:00:46 +11:00
1 parent 6cc8107ebb
commit e6a2a16bba
1 file changed
-20
@@ -80,30 +80,10 @@ function newTask(): void {
emit("newTask");
}
// '/' opens only when the keystroke was not meant for a field.
function isEditableTarget(event: KeyboardEvent): boolean {
const el = event.target;
return (
el instanceof HTMLElement &&
(el.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName))
);
}
function onGlobalKeydown(event: KeyboardEvent): void {
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
event.preventDefault();
open.value = !open.value;
} else if (
// A bare "/" only: Ctrl+/ belongs to the chat dock.
event.key === "/" &&
!event.ctrlKey &&
!event.metaKey &&
!event.altKey &&
!open.value &&
!isEditableTarget(event)
) {
event.preventDefault();
open.value = true;
}
}