diff --git a/Electrum.sqlite-journal b/Electrum.sqlite-journal index 2ed0965..8e93564 100644 Binary files a/Electrum.sqlite-journal and b/Electrum.sqlite-journal differ diff --git a/src/tui/screens/ActionWizard.tsx b/src/tui/screens/ActionWizard.tsx index 7fb12bd..aafe51d 100644 --- a/src/tui/screens/ActionWizard.tsx +++ b/src/tui/screens/ActionWizard.tsx @@ -486,23 +486,37 @@ export function ActionWizardScreen(): React.ReactElement { // Check if TextInput should have exclusive focus (variables step with content focus) const textInputHasFocus = currentStepData?.type === 'variables' && focusArea === 'content'; - // Handle keyboard navigation - useInput((input, key) => { - // When TextInput has focus, only handle Tab to navigate away - if (textInputHasFocus) { - if (key.tab) { - // Move to next variable or to buttons - if (focusedInput < variables.length - 1) { - setFocusedInput(prev => prev + 1); - } else { - setFocusArea('buttons'); - setFocusedButton('next'); - } - } - // Let TextInput handle all other input - return; + /** + * Handle TextInput submit (Enter key) - moves to next variable or buttons. + */ + const handleTextInputSubmit = useCallback(() => { + if (focusedInput < variables.length - 1) { + setFocusedInput(prev => prev + 1); + } else { + setFocusArea('buttons'); + setFocusedButton('next'); } + }, [focusedInput, variables.length]); + // Handle Tab key when in TextInput mode (separate from main useInput to allow Tab navigation) + useInput((input, key) => { + if (key.tab) { + if (focusedInput < variables.length - 1) { + setFocusedInput(prev => prev + 1); + } else { + setFocusArea('buttons'); + setFocusedButton('next'); + } + } + // Escape to go back to content from anywhere + if (key.escape && focusArea === 'buttons') { + setFocusArea('content'); + } + }, { isActive: textInputHasFocus }); + + // Handle keyboard navigation for non-TextInput modes + // IMPORTANT: Disable when TextInput should have focus to allow character input + useInput((input, key) => { // Tab to switch between content and buttons if (key.tab) { if (focusArea === 'content') { @@ -575,7 +589,7 @@ export function ActionWizardScreen(): React.ReactElement { if (input === 'n' && currentStepData?.type === 'inputs') { setAvailableUtxos(prev => prev.map(u => ({ ...u, selected: false }))); } - }); + }, { isActive: !textInputHasFocus }); // Get action details const action = template?.actions?.[actionIdentifier ?? '']; @@ -630,6 +644,7 @@ export function ActionWizardScreen(): React.ReactElement { updateVariable(index, value)} + onSubmit={handleTextInputSubmit} focus={focusArea === 'content' && focusedInput === index} placeholder={`Enter ${variable.name}...`} /> @@ -637,6 +652,11 @@ export function ActionWizardScreen(): React.ReactElement { ))} + + + Enter: Next field • Tab: Go to buttons + + );