Skip to content

Enter sends the prompt, Shift+Enter breaks the line (fix #1510) - #1530

Merged
suleimansh merged 1 commit into
mainfrom
the-framework/enter-sends-prompt
Aug 10, 2026
Merged

Enter sends the prompt, Shift+Enter breaks the line (fix #1510)#1530
suleimansh merged 1 commit into
mainfrom
the-framework/enter-sends-prompt

Conversation

@suleimansh

Copy link
Copy Markdown
Member

What

Plain Enter now submits the composer, matching Claude Code web (#1510); Shift+Enter stays a line break, and Cmd/Ctrl+Enter keeps working everywhere it did.

Enter steps aside where it already means something at the caret:

  • an open suggestion menu (/ < @ #) — Enter picks the highlighted item, as before
  • a code block — Enter types a newline
  • an IME composition — confirming a composition never sends

How

The direct editorProps.handleKeyDown outranks the suggestion plugins' handlers, so it can't just grab Enter — it checks the editor's aria-expanded before submitting. That attribute (set by the suggestion popup) now tracks the menu's actual visibility rather than the plugin's active range: a non-matching query hides the menu but used to leave aria-expanded="true" behind, which both lied to the a11y tree and would have swallowed Enter. draw() now owns the attribute and clears aria-activedescendant when the menu hides.

One change covers every composer surface (launcher, in-session, compact navbar) — they all render PromptEditor. The submit button's tooltip hint updates from (⌘↵ / Ctrl+Enter) to (Enter · Shift+Enter for a new line).

Tests

New PromptEditor.test.tsx mounts the real Tiptap editor (the existing Composer tests mock it, so the keyboard seam itself was uncovered): plain Enter submits; Shift/Alt+Enter don't; Cmd/Ctrl+Enter still do; Enter is left alone while aria-expanded="true"; Enter during IME composition doesn't send.

Full dashboard suite: 82 files / 801 tests passing, typecheck clean.

Worth a quick manual pass on the menu flow (type /, Enter picks — doesn't send) before merging.

🤖 Generated with Claude Code

Aligns the composer with Claude Code web's bindings. Plain Enter submits
unless Enter already means something where the caret is: an open
suggestion menu (which uses it to pick), a code block (newline), or an
IME composition. Cmd/Ctrl+Enter keeps working.

The suggestion popup's aria-expanded now tracks the menu's actual
visibility instead of the plugin's active range — it doubles as the
Enter guard's signal, and stops announcing an open menu that a
non-matching query already hid.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@suleimansh
suleimansh merged commit b5f133b into main Aug 10, 2026
1 check passed
@suleimansh
suleimansh deleted the the-framework/enter-sends-prompt branch August 10, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant