@devries-cameron20 / t3code-1 / commits / 4309a05652
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): honor the send shortcut for follow-up actions (#20929)

David Atkins committed Oct 19, 2026 at 03:53 UTC 4309a056527722707d301327895454c5105369a6
7 files changed +191 -58
apps/web/src/components/ChatView.tsx
+2
@@ -174,6 +174,7 @@ import { useActiveThreadRef } from "../hooks/useActiveThreadRef";
174 import {
175 type ComposerSubmissionIntent,
176 collapseExpandedComposerCursor,
177 + composerRequiresModifier,
178 parseStandaloneComposerSlashCommand,
179 } from "../composer-logic";
180 import {
@@ -5480,6 +5481,7 @@ export default function ChatView(props: ChatViewProps) {
5481 composerFocus: document.activeElement?.getAttribute("data-testid") === "composer-editor",
5482 draftThreadRoute: routeKind === "draft",
5483 turnRunning: phase === "running",
5484 + composerRequiresModifier: composerRequiresModifier(settings.sendShortcut, promptRef.current),
5485 isWeb: !isElectron,
5486 isDesktop: isElectron,
5487 });
apps/web/src/components/chat/ChatComposer.tsx
+5
@@ -83,6 +83,7 @@ import {
83 type ComposerTrigger,
84 type ComposerSubmissionIntent,
85 collapseExpandedComposerCursor,
86 + composerRequiresModifier,
87 composerSubmissionIntentForKey,
88 composerStateAtPromptEnd,
89 detectComposerTrigger,
@@ -7232,6 +7233,10 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
7233 composerFocus: true,
7234 draftThreadRoute: routeKind === "draft",
7235 turnRunning: true,
7236 + composerRequiresModifier: composerRequiresModifier(
7237 + settings.sendShortcut,
7238 + prompt,
7239 + ),
7240 },
7241 },
7242 )}
apps/web/src/composer-logic.test.ts
+108 -51
@@ -102,10 +102,25 @@ describe("composerSubmissionIntentForKey", () => {
102 metaKey: platform === "MacIntel",
103 ctrlKey: platform !== "MacIntel",
104 };
105 - for (const sendShortcut of ["enter", "mod-enter", "mod-enter-multiline"] as const) {
106 - const running = { ...input, platform, sendShortcut, prompt: "two\nlines", isRunning: true };
105 + for (const [sendShortcut, prompt, requiresModifier] of [
106 + ["enter", "one line", false],
107 + ["enter", "two\nlines", false],
108 + ["mod-enter", "one line", true],
109 + ["mod-enter", "two\nlines", true],
110 + ["mod-enter-multiline", "one line", false],
111 + ["mod-enter-multiline", "two\nlines", true],
112 + ] as const) {
113 + const running = { ...input, platform, sendShortcut, prompt, isRunning: true };
114 const intent = composerSubmissionIntentForKey({ ...running, event: modEnter });
108 - expect(intent).toBe("alternate");
115 + expect(intent).toBe(requiresModifier ? "foreground" : "alternate");
116 + const alternateIntent = composerSubmissionIntentForKey({
117 + ...running,
118 + event: { ...modEnter, shiftKey: requiresModifier },
119 + });
120 + expect(alternateIntent).toBe("alternate");
121 + expect(composerSubmissionIntentForKey({ ...running, event: enter })).toBe(
122 + requiresModifier ? null : "foreground",
123 + );
124 for (const activeTurnDefault of ["queue", "steer"] as const) {
125 expect(
126 resolveComposerDispatchMode({
@@ -113,6 +128,15 @@ describe("composerSubmissionIntentForKey", () => {
128 alternateModifier: intent === "alternate",
129 activeTurnDefault,
130 }),
131 + ).toBe(
132 + requiresModifier ? activeTurnDefault : activeTurnDefault === "queue" ? "steer" : "queue",
133 + );
134 + expect(
135 + resolveComposerDispatchMode({
136 + running: true,
137 + alternateModifier: alternateIntent === "alternate",
138 + activeTurnDefault,
139 + }),
140 ).toBe(activeTurnDefault === "queue" ? "steer" : "queue");
141 }
142 expect(
@@ -137,6 +161,7 @@ describe("composerSubmissionIntentForKey", () => {
161 ...input,
162 platform,
163 sendShortcut,
164 + prompt,
165 isDraftThread: true,
166 event: modEnter,
167 }),
@@ -157,6 +182,28 @@ describe("composerSubmissionIntentForKey", () => {
182 ).toBeNull();
183 });
184
185 + it("honors the send preference with an existing install's saved alternate binding", () => {
186 + const keybindings = mergeWithDefaultKeybindings(
187 + compileResolvedKeybindingsConfig([
188 + {
189 + key: "mod+enter",
190 + command: "composer.sendAlternate",
191 + when: "composerFocus && turnRunning",
192 + },
193 + ]),
194 + );
195 + const running = { ...input, keybindings, isRunning: true, sendShortcut: "mod-enter" as const };
196 + expect(composerSubmissionIntentForKey({ ...running, event: { ...enter, ctrlKey: true } })).toBe(
197 + "foreground",
198 + );
199 + expect(
200 + composerSubmissionIntentForKey({
201 + ...running,
202 + event: { ...enter, ctrlKey: true, shiftKey: true },
203 + }),
204 + ).toBe("alternate");
205 + });
206 +
207 it("does not start a background thread with the queued-message shortcut", () => {
208 expect(
209 composerSubmissionIntentForKey({
@@ -186,54 +233,64 @@ describe("composerSubmissionIntentForKey", () => {
233 ).toBe("background");
234 });
235
189 - it("uses remapped keys and removes the old action bindings", () => {
190 - const keybindings = mergeWithDefaultKeybindings(
191 - compileResolvedKeybindingsConfig([
192 - {
193 - key: "alt+q",
194 - command: "composer.sendAlternate",
195 - when: "composerFocus && turnRunning",
196 - },
197 - {
198 - key: "alt+b",
199 - command: "composer.sendBackground",
200 - when: "composerFocus && draftThreadRoute",
201 - },
202 - ]),
203 - );
204 - const custom = { ...input, keybindings };
205 - expect(
206 - composerSubmissionIntentForKey({
207 - ...custom,
208 - isRunning: true,
209 - event: { ...enter, key: "q", altKey: true },
210 - }),
211 - ).toBe("alternate");
212 - expect(
213 - composerSubmissionIntentForKey({
214 - ...custom,
215 - isDraftThread: true,
216 - event: { ...enter, key: "b", altKey: true },
217 - }),
218 - ).toBe("background");
219 - expect(
220 - composerSubmissionIntentForKey({
221 - ...custom,
222 - isRunning: true,
223 - event: { ...enter, ctrlKey: true },
224 - }),
225 - ).toBe("foreground");
226 - expect(
227 - composerSubmissionIntentForKey({
228 - ...custom,
229 - isDraftThread: true,
230 - event: { ...enter, ctrlKey: true, shiftKey: true },
231 - }),
232 - ).toBeNull();
233 - expect(
234 - composerSubmissionIntentForKey({ ...custom, event: { ...enter, key: "b", altKey: true } }),
235 - ).toBeNull();
236 - });
236 + it.each(["enter", "mod-enter", "mod-enter-multiline"] as const)(
237 + "uses remapped keys and removes the old action bindings with %s",
238 + (sendShortcut) => {
239 + const keybindings = mergeWithDefaultKeybindings(
240 + compileResolvedKeybindingsConfig([
241 + {
242 + key: "alt+q",
243 + command: "composer.sendAlternate",
244 + when: "composerFocus && turnRunning",
245 + },
246 + {
247 + key: "alt+b",
248 + command: "composer.sendBackground",
249 + when: "composerFocus && draftThreadRoute",
250 + },
251 + ]),
252 + );
253 + const custom = { ...input, keybindings, sendShortcut, prompt: "two\nlines" };
254 + expect(
255 + composerSubmissionIntentForKey({
256 + ...custom,
257 + isRunning: true,
258 + event: { ...enter, key: "q", altKey: true },
259 + }),
260 + ).toBe("alternate");
261 + expect(
262 + composerSubmissionIntentForKey({
263 + ...custom,
264 + isDraftThread: true,
265 + event: { ...enter, key: "b", altKey: true },
266 + }),
267 + ).toBe("background");
268 + expect(
269 + composerSubmissionIntentForKey({
270 + ...custom,
271 + isRunning: true,
272 + event: { ...enter, ctrlKey: true },
273 + }),
274 + ).toBe("foreground");
275 + expect(
276 + composerSubmissionIntentForKey({
277 + ...custom,
278 + isDraftThread: true,
279 + event: { ...enter, ctrlKey: true, shiftKey: true },
280 + }),
281 + ).toBeNull();
282 + expect(
283 + composerSubmissionIntentForKey({
284 + ...custom,
285 + isRunning: true,
286 + event: { ...enter, ctrlKey: true, shiftKey: true },
287 + }),
288 + ).toBeNull();
289 + expect(
290 + composerSubmissionIntentForKey({ ...custom, event: { ...enter, key: "b", altKey: true } }),
291 + ).toBeNull();
292 + },
293 + );
294
295 it.each([
296 { isMobileViewport: true },
apps/web/src/composer-logic.ts
+2 -1
@@ -27,7 +27,7 @@ export function formatAssistantCitationForComposer(citation: AssistantCitation,
27 return `${serializeAssistantCitation(withAssistantCitationComment(citation, comment))} `;
28 }
29
30 -function composerRequiresModifier(
30 +export function composerRequiresModifier(
31 sendShortcut: ClientSettings["sendShortcut"] | undefined,
32 prompt: string,
33 ) {
@@ -56,6 +56,7 @@ export function composerSubmissionIntentForKey(input: {
56 composerFocus: true,
57 draftThreadRoute: input.isDraftThread,
58 turnRunning: input.isRunning === true,
59 + composerRequiresModifier: composerRequiresModifier(input.sendShortcut, input.prompt ?? ""),
60 },
61 });
62 if (command === "composer.sendAlternate" && input.isRunning) return "alternate";
apps/web/src/keybindings.test.ts
+42
@@ -1453,6 +1453,48 @@ describe("composer and pull request shortcuts", () => {
1453 ["Enter", "thread.steerQueuedMessage"],
1454 ] as const;
1455
1456 + it.each(["MacIntel", "Win32", "Linux"])(
1457 + "reserves the alternate send chord for the focused composer on %s",
1458 + (platform) => {
1459 + const modifier = {
1460 + metaKey: platform === "MacIntel",
1461 + ctrlKey: platform !== "MacIntel",
1462 + };
1463 + const shiftedEnter = event({ key: "Enter", shiftKey: true, ...modifier });
1464 + for (const composerRequiresModifier of [false, true]) {
1465 + const context = {
1466 + composerFocus: true,
1467 + turnRunning: true,
1468 + composerRequiresModifier,
1469 + };
1470 + assert.strictEqual(
1471 + resolveShortcutCommand(shiftedEnter, DEFAULT_RESOLVED_KEYBINDINGS, {
1472 + platform,
1473 + context,
1474 + }),
1475 + composerRequiresModifier ? "composer.sendAlternate" : "thread.steerQueuedMessage",
1476 + );
1477 + assert.strictEqual(
1478 + shortcutLabelForCommand(DEFAULT_RESOLVED_KEYBINDINGS, "composer.sendAlternate", {
1479 + platform,
1480 + context,
1481 + }),
1482 + formatShortcutLabel(
1483 + modShortcut("enter", { shiftKey: composerRequiresModifier }),
1484 + platform,
1485 + ),
1486 + );
1487 + assert.strictEqual(
1488 + resolveShortcutCommand(shiftedEnter, DEFAULT_RESOLVED_KEYBINDINGS, {
1489 + platform,
1490 + context: { ...context, composerFocus: false },
1491 + }),
1492 + "thread.steerQueuedMessage",
1493 + );
1494 + }
1495 + },
1496 + );
1497 +
1498 it.each(["MacIntel", "Win32", "Linux"])(
1499 "separates queued steering and background start on %s",
1500 (platform) => {
apps/web/src/keybindings.ts
+24 -3
@@ -2,6 +2,7 @@ import {
2 type KeybindingCommand,
3 type KeybindingShortcut,
4 type KeybindingWhenNode,
5 + type ResolvedKeybindingRule,
6 MODEL_PICKER_JUMP_KEYBINDING_COMMANDS,
7 type ResolvedKeybindingsConfig,
8 THREAD_JUMP_KEYBINDING_COMMANDS,
@@ -104,6 +105,25 @@ export function shortcutConflictKey(
105 ].join("|");
106 }
107
108 +function shortcutForContext(binding: ResolvedKeybindingRule, context: ShortcutMatchContext) {
109 + const shortcut = binding.shortcut;
110 + // Existing installs persist Mod+Enter. Resolve its alternate chord against
111 + // the send preference without rewriting saved or remapped shortcuts.
112 + if (
113 + context.composerRequiresModifier &&
114 + binding.command === "composer.sendAlternate" &&
115 + shortcut.key === "enter" &&
116 + shortcut.modKey &&
117 + !shortcut.metaKey &&
118 + !shortcut.ctrlKey &&
119 + !shortcut.altKey &&
120 + !shortcut.shiftKey
121 + ) {
122 + return { ...shortcut, shiftKey: true };
123 + }
124 + return shortcut;
125 +}
126 +
127 export function effectiveShortcutsForCommand(
128 keybindings: ResolvedKeybindingsConfig,
129 command: KeybindingCommand,
@@ -119,14 +139,15 @@ export function effectiveShortcutsForCommand(
139 if (!binding) continue;
140 if (!matchesWhenClause(binding.whenAst, context)) continue;
141
122 - const conflictKey = shortcutConflictKey(binding.shortcut, platform);
142 + const shortcut = shortcutForContext(binding, context);
143 + const conflictKey = shortcutConflictKey(shortcut, platform);
144 if (claimedShortcuts.has(conflictKey)) {
145 continue;
146 }
147
148 claimedShortcuts.add(conflictKey);
149 if (binding.command === command) {
129 - effective.push(binding.shortcut);
150 + effective.push(shortcut);
151 }
152 }
153
@@ -162,7 +183,7 @@ export function resolveShortcutCommand(
183 const binding = keybindings[index];
184 if (!binding) continue;
185 if (!matchesWhenClause(binding.whenAst, context)) continue;
165 - if (!matchesKeybindingShortcut(event, binding.shortcut, platform)) continue;
186 + if (!matchesKeybindingShortcut(event, shortcutForContext(binding, context), platform)) continue;
187 return binding.command;
188 }
189 return null;
docs/user/composer.md
+8 -3
@@ -55,12 +55,17 @@ On web and desktop, choose **Settings → General → Follow-up behavior** to qu
55 new messages for a later turn or steer the running turn immediately. The setting
56 applies to this client; already queued messages keep their place. Queued messages
57 are saved on the server and can be edited, reordered, or removed above the composer.
58 -`Cmd+Enter` on macOS or `Ctrl+Enter` on Windows and Linux uses the opposite action:
59 -it steers when your default is Queue and queues when your default is Steer.
58 +When Enter sends, `Cmd+Enter` on macOS or `Ctrl+Enter` on Windows and Linux uses
59 +the opposite action: it steers when your default is Queue and queues when your
60 +default is Steer.
61 +If your **Send shortcut** requires `Cmd+Enter` or `Ctrl+Enter`, that shortcut uses
62 +your default follow-up behavior; add **Shift** to use the opposite action. This
63 +applies only to multiline messages when you choose the multiline send option.
64
65 Use `Cmd+Shift+Enter` on macOS or `Ctrl+Shift+Enter` on Windows and Linux to send
66 the oldest queued message as a steer. This leaves the current draft intact and
63 -requires an active turn that supports steering. Change
67 +requires an active turn that supports steering. If that shortcut sends the opposite
68 +action for your draft, move focus outside the composer to steer the queued message. Change
69 `thread.steerQueuedMessage` in **Settings → Keybindings** to use another shortcut.
70
71 Press `Option+Up` on macOS or `Alt+Up` on Windows and Linux with the cursor at the