Skip to content

Commit 9dcb083

Browse files
committed
fix: ignore key repeat on space for voice input
Holding space was triggering start→send in rapid succession, causing gibberish to be sent. Now checks e.repeat to only act on initial press.
1 parent 38d0f2c commit 9dcb083

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/browser/components/ChatInput/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
499499
// Global keybinds only active during recording
500500
const handleKeyDown = (e: KeyboardEvent) => {
501501
if (voiceInput.state !== "recording") return;
502-
if (e.key === " ") {
502+
if (e.key === " " && !e.repeat) {
503503
e.preventDefault();
504504
voiceInput.stop({ send: true });
505505
} else if (e.key === "Escape") {
@@ -862,9 +862,10 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
862862
return;
863863
}
864864

865-
// Space on empty input starts voice recording
865+
// Space on empty input starts voice recording (ignore key repeat from holding)
866866
if (
867867
e.key === " " &&
868+
!e.repeat &&
868869
input.trim() === "" &&
869870
voiceInput.shouldShowUI &&
870871
voiceInput.isApiKeySet &&

0 commit comments

Comments
 (0)