File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/browser/components/ChatInput Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -497,16 +497,22 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
497497 } ;
498498
499499 // Global keybinds only active during recording
500+ // Track if space is held to prevent start→send on hold
501+ let spaceHeld = true ; // Assume held since recording just started via space
502+ const handleKeyUp = ( e : KeyboardEvent ) => {
503+ if ( e . key === " " ) spaceHeld = false ;
504+ } ;
500505 const handleKeyDown = ( e : KeyboardEvent ) => {
501506 if ( voiceInput . state !== "recording" ) return ;
502- if ( e . key === " " ) {
507+ if ( e . key === " " && ! spaceHeld ) {
503508 e . preventDefault ( ) ;
504509 voiceInput . stop ( { send : true } ) ;
505510 } else if ( e . key === "Escape" ) {
506511 e . preventDefault ( ) ;
507512 voiceInput . cancel ( ) ;
508513 }
509514 } ;
515+ window . addEventListener ( "keyup" , handleKeyUp ) ;
510516
511517 window . addEventListener ( CUSTOM_EVENTS . TOGGLE_VOICE_INPUT , handleToggle as EventListener ) ;
512518 window . addEventListener ( "keydown" , handleKeyDown ) ;
@@ -862,9 +868,10 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
862868 return ;
863869 }
864870
865- // Space on empty input starts voice recording
871+ // Space on empty input starts voice recording (ignore key repeat from holding)
866872 if (
867873 e . key === " " &&
874+ ! e . repeat &&
868875 input . trim ( ) === "" &&
869876 voiceInput . shouldShowUI &&
870877 voiceInput . isApiKeySet &&
You can’t perform that action at this time.
0 commit comments