MCPcopy Create free account
hub / github.com/arctic-cli/interface / handleKey

Function handleKey

packages/ui/src/components/list.tsx:72–87  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

70 }
71
72 const handleKey = (e: KeyboardEvent) => {
73 setStore("mouseActive", false)
74 if (e.key === "Escape") return
75
76 const all = flat()
77 const selected = all.find((x) => props.key(x) === active())
78 const index = selected ? all.indexOf(selected) : -1
79 props.onKeyEvent?.(e, selected)
80
81 if (e.key === "Enter") {
82 e.preventDefault()
83 if (selected) handleSelect(selected, index)
84 } else {
85 onKeyDown(e)
86 }
87 }
88
89 props.ref?.({
90 onKeyDown: handleKey,

Callers

nothing calls this directly

Calls 2

handleSelectFunction · 0.70
onKeyDownFunction · 0.50

Tested by

no test coverage detected