From 783b9b219c90fcf929513171867c1054b3ccb1f4 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 13 Jan 2024 09:29:43 -0800 Subject: [PATCH] fix: dont hijack handlers when search is not focused (closes #680) --- quartz/components/scripts/search.inline.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index 2858e0fd1..de3de2be3 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -110,6 +110,7 @@ document.addEventListener("nav", async (e: unknown) => { } function shortcutHandler(e: HTMLElementEventMap["keydown"]) { + if (!container?.classList.contains("active")) return if (e.key === "k" && (e.ctrlKey || e.metaKey) && !e.shiftKey) { e.preventDefault() const searchBarOpen = container?.classList.contains("active")