MCPcopy
hub / github.com/codeaashu/claude-code / handleKeyDown

Function handleKeyDown

src/components/design-system/FuzzyPicker.tsx:123–155  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

121 backspaceExitsOnEmpty: false
122 });
123 const handleKeyDown = (e: KeyboardEvent) => {
124 if (e.key === 'up' || e.ctrl && e.key === 'p') {
125 e.preventDefault();
126 e.stopImmediatePropagation();
127 step(direction === 'up' ? 1 : -1);
128 return;
129 }
130 if (e.key === 'down' || e.ctrl && e.key === 'n') {
131 e.preventDefault();
132 e.stopImmediatePropagation();
133 step(direction === 'up' ? -1 : 1);
134 return;
135 }
136 if (e.key === 'return') {
137 e.preventDefault();
138 e.stopImmediatePropagation();
139 const selected = items[focusedIndex];
140 if (selected) onSelect(selected);
141 return;
142 }
143 if (e.key === 'tab') {
144 e.preventDefault();
145 e.stopImmediatePropagation();
146 const selected = items[focusedIndex];
147 if (!selected) return;
148 const tabAction = e.shift ? onShiftTab ?? onTab : onTab;
149 if (tabAction) {
150 tabAction.handler(selected);
151 } else {
152 onSelect(selected);
153 }
154 }
155 };
156 useEffect(() => {
157 onQueryChange(query);
158 setFocusedIndex(0);

Callers

nothing calls this directly

Calls 4

preventDefaultMethod · 0.80
stepFunction · 0.70
onSelectFunction · 0.50

Tested by

no test coverage detected