refactor(input): simplify KeybindingOptions to fallback/bubble#52
Merged
refactor(input): simplify KeybindingOptions to fallback/bubble#52
Conversation
…/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.
ecef6d9 to
a9c5efa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the three-field
KeybindingOptionsAPI with two clearer fields:fallback— handler for keys that don't match any named binding (replacesonKeypress+capture)bubble— keys that skip the fallback and propagate to parent scopes (replacespassthrough)Why:
captureconflicted with DOM capture semantics (top-down vs bottom-up),onKeypressimplied it fired on every keypress when it's really a fallback, and thecaptureboolean was redundant with the presence ofonKeypress. 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 passingundefinedfor the options argument when the mode is inactive.Changes
src/core/input/types.ts— newKeybindingOptionstypesrc/core/focus/FocusStore.ts— internal types, registration, merge logic, dispatch variable namessrc/ui/TextInput.tsx,Autocomplete.tsx,CommandPalette.tsx— updated to new optionsdocumentation/content/docs/core/input.mdx— rewrote KeybindingOptions section with priority table, updated all examplesdocumentation/content/docs/framework/core-concepts.mdx,agentic-coding.mdx— updated referencesdocumentation/src/components/examples/input/— updated live examples to conditional patternTest plan
npx tsc --noEmitpasses (verified)pnpm buildthen check docs site — live examples in Terminal components still work