Skip to content

Single-letter shortcuts (s, w, m, y) intercept text input in New Session form #344

@afterthought

Description

@afterthought

Bug Description

When creating a new session and a text input field is focused (Name, Path, or Custom command), pressing s, w, m, or y toggles checkboxes (sandbox, worktree, multi-repo, YOLO) instead of typing those letters into the text field.

Steps to Reproduce

  1. Open Agent Deck TUI
  2. Create a new session (Enter on a group)
  3. Focus the "Name" field or navigate to the "Custom" command input
  4. Try to type a word containing the letter s (e.g., "openspec")
  5. Instead of typing s, the "Run in Docker sandbox" checkbox toggles

Expected Behavior

When a text input field has focus, all letter keys should type into the input. Shortcut keys (s, w, m, y) should only toggle checkboxes when no text input is actively focused.

Root Cause

In internal/ui/newdialog.go, the Update method's key handler matches single-letter shortcuts and returns early before the text input .Update(msg) calls at the bottom of the method. The shortcut cases check cur == focusCommand but don't verify whether a text input within that target is actually receiving input (i.e., commandCursor == 0).

For focusName and focusPath, the shortcuts fire unconditionally.

Suggested Fix

Add a helper to detect when a text input is focused, and skip single-letter shortcuts in that state:

func (d *NewDialog) isTextInputFocused() bool {
    cur := d.currentTarget()
    switch cur {
    case focusName, focusPath, focusBranch:
        return true
    case focusCommand:
        return d.commandCursor == 0
    default:
        return false
    }
}

Then guard the single-letter shortcut cases so they only fire when !d.isTextInputFocused().

Environment

  • agent-deck: latest (installed via Nix)
  • OS: macOS (Darwin)
  • Terminal: Ghostty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions