You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add keyMap prop for selective key group disabling
Ink does not support event propagation stopping — all useInput handlers in
the app receive every keypress simultaneously. The new keyMap prop lets
consumers opt individual key groups out of the component's handler without
affecting any parent-level bindings.
Groups: arrows, vimKeys, homeEnd, cancel, select, toggle (all default true).
isFocused={false} remains the way to disable all input at once.
Exports KeyMap type from package root. 9 new tests; 142 total passing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: readme.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -213,6 +213,45 @@ When typing:
213
213
- Hotkeys are disabled (characters go to the search query)
214
214
- "No matches" is shown when the query matches nothing
215
215
216
+
### Avoiding Key Conflicts (`keyMap`)
217
+
218
+
Because Ink does not support event propagation stopping, every `useInput` handler in your app receives every keypress simultaneously. If your application already binds one of the component's default keys globally, you can disable individual key groups with the `keyMap` prop — the component ignores those keys without interfering with your own handlers.
219
+
220
+
```tsx
221
+
// j/k are used by a parent vim-style navigator — disable them here
222
+
<EnhancedSelectInput
223
+
items={items}
224
+
keyMap={{ vimKeys: false }}
225
+
onSelect={onSelect}
226
+
/>
227
+
228
+
// Parent handles Escape itself — don't fire onCancel
229
+
<EnhancedSelectInput
230
+
items={items}
231
+
keyMap={{ cancel: false }}
232
+
onSelect={onSelect}
233
+
/>
234
+
235
+
// Arrows-only navigation — disable vim keys, Home/End, and Space toggle
0 commit comments