Skip to content

tui: playbook selection menu is shown but unfocused — Enter replaces the selection instead of running it #1092

Open

Description

@edwin-zvs

Selecting text in the Playbook pops the selection action menu:

┌────────────────────────────────────────────┐
│ type additional instruction          ▸ Run │
│ ▸ Challenge assumptions                    │
│ ▸ Simplify                                 │
│ ▸ Crystallize spec                         │
│ ▸ Interview                                │
└────────────────────────────────────────────┘

It is visible but not focused. Keys only reach it once Tab has focused it:

let menu_focused = … .is_some_and(|menu| menu.focused);
if !menu_focused {
    if matches!(key.code, KeyCode::Tab) && … { menu.focused = true; return true; }
    return false;
}

(crates/cli/src/app/editor.rs ~lines 1095–1110 @ ad47152)

Until then Enter falls through to the editor and hits insert_playbook_newline, which — with a selection active — takes the PlaybookNewline::Plain branch and replaces the selection with a newline (editor.rs ~line 2507).

Nothing in the menu advertises Tab. The rendered rows carry ▸ markers that read as "activatable now", and Enter is the obvious gesture for a menu with a highlighted ▸ Run row.

Repro

  1. Open a Playbook in the TUI.
  2. Select a few lines with S-Down (the menu appears).
  3. Press Enter.

Observed: the selection is deleted and replaced with a newline. In my session this destroyed a @{session:…} clip line. Recovery is C-x u, which currently desyncs the document (#1088).

With Tab first, the flow works correctly — the verb rows, the comment field, and Enter → Run all behave as documented.

Expected

Either:

  • Enter activates the highlighted row while the menu is showing (with the caret keys still editing the document until the menu is focused), or
  • the menu renders a Tab affordance so the focus model is discoverable — the focused menu already shows a help line (Free-text guidance appended to Run or the …), the unfocused one shows nothing.

Destroying a multi-line selection should not be the default outcome of pressing Enter at a menu that offers ▸ Run.

Acceptance criteria

  • With the selection menu visible, Enter either runs the highlighted action or the menu tells the user which key focuses it.
  • The web UI's selection menu is checked for the same affordance gap.

Found during a hands-on UX audit of the Playbook in the TUI and web UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions