Skip to content

Commit b7e7f0d

Browse files
🤖 fix: prevent Escape from interrupting stream during voice recording (#1184)
When recording voice input while streaming, pressing Escape to cancel recording would also interrupt the active chat stream. This is the same issue fixed in PR #954 (workspace renaming) and PR #1010 (message editing). Added `stopPropagation()` to the Escape handler in `useVoiceInput.ts` to prevent the event from reaching the global stream interrupt handler in `useAIViewKeybinds`. I explored ways to unify this pattern (centralized Escape registry, checking `defaultPrevented`, single global handler with state checks) but none were better than the simple `stopPropagation()` approach—each adds coupling or complexity without meaningful benefit. The DOM's event propagation model is designed for exactly this case. Closes #1170 --- _Generated with `mux`
1 parent 01e48c6 commit b7e7f0d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎src/browser/hooks/useVoiceInput.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export function useVoiceInput(options: UseVoiceInputOptions): UseVoiceInputResul
335335
stop({ send: true });
336336
} else if (e.key === "Escape") {
337337
e.preventDefault();
338+
e.stopPropagation(); // Prevent global stream interrupt handler
338339
cancel();
339340
} else if (matchesKeybind(e, KEYBINDS.TOGGLE_VOICE_INPUT)) {
340341
e.preventDefault();

0 commit comments

Comments
 (0)