Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(composer): ignore auto-repeat of a held dictation shortcut
AdityaUmale618682611e66
diff --git a/src/components/Composer.dictation.test.ts b/src/components/Composer.dictation.test.tsindex 6f067a2a77..de7cc01bd4 100644--- a/src/components/Composer.dictation.test.ts+++ b/src/components/Composer.dictation.test.ts@@ -129,6 +129,20 @@ describe("native dictation in the real composer", () => {expect(button(t("composer.dictation.stop"))).not.toBeNull();});+ it("ignores the repeats of a held dictation shortcut", () => {+ const press = (repeat: boolean) => {+ const event = new KeyboardEvent("keydown", { key: "d", code: "KeyD", repeat, bubbles: true, cancelable: true, ...(isMacPlatform() ? { metaKey: true } : { ctrlKey: true }) });+ flushSync(() => input().dispatchEvent(event));+ return event;+ };+ press(false);+ expect(speechStop).toHaveBeenCalledOnce();+ expect(press(true).defaultPrevented).toBe(true);+ expect(press(true).defaultPrevented).toBe(true);+ expect(speechStart).toHaveBeenCalledOnce();+ expect(button(t("composer.dictation.start"))).not.toBeNull();+ });+it("accepts multiple recognition results before React paints", () => {flushSync(() => {transcript({ text: "一", partial: true });diff --git a/src/components/Composer.tsx b/src/components/Composer.tsxindex 30b3080255..e89c4eae91 100644--- a/src/components/Composer.tsx+++ b/src/components/Composer.tsx@@ -881,7 +881,7 @@ export function Composer({}if (micShown && isDictationToggle(e.nativeEvent)) {e.preventDefault();- toggleMic();+ if (!e.nativeEvent.repeat) toggleMic();return;}if (onClearReply && escapeCancelsReply(e.nativeEvent, { replying: Boolean(replyTo), recording })) {