Fix: Prevent text input from capturing j/k keys during base branch selection #36
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
Fix keyboard navigation issue in the new worktree creation form where j/k keys were being captured by the text input field instead of navigating the base branch selection list.
Description
Problem
When creating a new worktree and reaching the base branch selection step, pressing j or k keys would insert text into the branch name input field instead of navigating up/down through the branch list. This occurred because the text input component was still being rendered even during the base branch selection phase.
Solution
Modified the conditional rendering logic in
NewWorktree.tsx
to ensure that the text input is only displayed during the branch name input step. When the user reaches the base branch selection step (step === 'base-branch'
), only theSelectInput
component is rendered, allowing j/k keys to properly navigate the branch list as expected.The fix adds an explicit check for
step === 'branch'
and returnsnull
for any other step that isn't explicitly handled, preventing the text input from capturing keyboard events during branch selection.EOF < /dev/null