fix: dont hijack handlers when search is not focused (closes #680)

This commit is contained in:
Jacky Zhao 2024-01-13 09:29:43 -08:00
parent 4014c4d6d6
commit 783b9b219c

View File

@ -110,6 +110,7 @@ document.addEventListener("nav", async (e: unknown) => {
} }
function shortcutHandler(e: HTMLElementEventMap["keydown"]) { function shortcutHandler(e: HTMLElementEventMap["keydown"]) {
if (!container?.classList.contains("active")) return
if (e.key === "k" && (e.ctrlKey || e.metaKey) && !e.shiftKey) { if (e.key === "k" && (e.ctrlKey || e.metaKey) && !e.shiftKey) {
e.preventDefault() e.preventDefault()
const searchBarOpen = container?.classList.contains("active") const searchBarOpen = container?.classList.contains("active")