MCPcopy Create free account
hub / github.com/arktypeio/arktype / onKeyDown

Function onKeyDown

ark/docs/components/shell/SearchDialog.tsx:55–64  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

53 const onOpen = (e: Event) =>
54 open((e as CustomEvent<string | null>).detail ?? "")
55 const onKeyDown = (e: KeyboardEvent) => {
56 if (e.key.toLowerCase() === "k" && (e.metaKey || e.ctrlKey)) {
57 e.preventDefault()
58 if (dialog.current?.open) dialog.current.close()
59 else open()
60 } else if (e.key === "/" && !isTyping(e.target)) {
61 e.preventDefault()
62 open()
63 }
64 }
65 window.addEventListener(openSearchEvent, onOpen)
66 window.addEventListener("keydown", onKeyDown)
67 if (new URLSearchParams(location.search).has("search")) open()

Callers

nothing calls this directly

Calls 3

openFunction · 0.85
isTypingFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected