Skip to content

refactor(input): simplify KeybindingOptions to fallback/bubble#52

Merged
zion-off merged 4 commits intomainfrom
simplify-input-api
Feb 25, 2026
Merged

refactor(input): simplify KeybindingOptions to fallback/bubble#52
zion-off merged 4 commits intomainfrom
simplify-input-api

Conversation

@zion-off
Copy link
Copy Markdown
Owner

@zion-off zion-off commented Feb 25, 2026

Summary

Replaces the three-field KeybindingOptions API with two clearer fields:

  • fallback — handler for keys that don't match any named binding (replaces onKeypress + capture)
  • bubble — keys that skip the fallback and propagate to parent scopes (replaces passthrough)

Why: capture conflicted with DOM capture semantics (top-down vs bottom-up), onKeypress implied it fired on every keypress when it's really a fallback, and the capture boolean was redundant with the presence of onKeypress. The three fields described one concept.

Behaviour change: the implicit conditional activation (named bindings from a capture registration being inactive when capture: false) is removed. Callers toggle mode explicitly by passing undefined for the options argument when the mode is inactive.

Changes

  • src/core/input/types.ts — new KeybindingOptions type
  • src/core/focus/FocusStore.ts — internal types, registration, merge logic, dispatch variable names
  • src/ui/TextInput.tsx, Autocomplete.tsx, CommandPalette.tsx — updated to new options
  • documentation/content/docs/core/input.mdx — rewrote KeybindingOptions section with priority table, updated all examples
  • documentation/content/docs/framework/core-concepts.mdx, agentic-coding.mdx — updated references
  • documentation/src/components/examples/input/ — updated live examples to conditional pattern
  • Internal ADRs (phase-1, phase-3, architecture-focus-store, tech-spec) — updated

Test plan

  • npx tsc --noEmit passes (verified)
  • pnpm build then check docs site — live examples in Terminal components still work
  • TextInput typing, backspace, cursor movement, tab/escape bubble
  • Autocomplete text input and tab navigation
  • CommandPalette search input
  • File manager search mode (conditional fallback toggle)

…/bubble

KeybindingOptions drops the three-field capture mode API in favour of two
clearer fields: `fallback` (handler for unmatched keys) and `bubble` (keys
that skip the fallback and propagate to parent scopes). The `capture` boolean
was redundant with the presence of `fallback`; `onKeypress` implied it fired
on every keypress; `passthrough` implied keys were blocked by default.

The conditional activation behaviour (named bindings inactive when capture
was false) is removed — callers toggle the fallback registration explicitly
by passing undefined options when the mode is inactive.
…h to fallback/bubble

Updates input.mdx, core-concepts.mdx, agentic-coding.mdx, doc examples, and
internal ADRs to reflect the new KeybindingOptions API. Rewrites the
KeybindingOptions section with a priority table instead of a prose dispatch
order, and removes the conditional activation callout.
@zion-off zion-off merged commit 3c7b712 into main Feb 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant