Universal submit shortcut: ⌘/Ctrl+Enter sends in every input

Key-convention policy, settled: every field accepts ⌘/Ctrl+Enter
(metaKey || ctrlKey — Mac gets ⌘↵, Windows/Linux Ctrl↵, the Gmail
convention); plain Enter stays matched to the field's species —
sends in message fields (chat composer, free-text answers — the
universal chat convention, Shift+Enter still a newline), newline in
the thinking field (composition, for dumping).
This commit is contained in:
amosblomqvist
2026-09-09 02:25:27 +03:00
parent abed10e13d
commit ba642416cd
2 changed files with 7 additions and 2 deletions
+4 -1
View File
@@ -42,7 +42,10 @@ export function Composer({
value={value} value={value}
onChange={(e) => onChange(e.target.value)} onChange={(e) => onChange(e.target.value)}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) { // Chat convention: Enter sends, Shift+Enter is a newline.
// ⌘/Ctrl+Enter also sends — the universal submit shortcut
// across every input in the app (thinking field, answers).
if (e.key === "Enter" && (e.metaKey || e.ctrlKey || !e.shiftKey)) {
e.preventDefault(); e.preventDefault();
if (busy) onStop(); if (busy) onStop();
else if (canSend) onSend(); else if (canSend) onSend();
+3 -1
View File
@@ -399,7 +399,9 @@ function QuestionDockForm({
value={text} value={text}
onChange={(e) => setText(e.target.value)} onChange={(e) => setText(e.target.value)}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) { // Chat convention: Enter submits, Shift+Enter is a newline;
// ⌘/Ctrl+Enter also submits (universal across the app).
if (e.key === "Enter" && (e.metaKey || e.ctrlKey || !e.shiftKey)) {
e.preventDefault(); e.preventDefault();
submit(); submit();
} }