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:
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user