Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Accounts card: focus stays put when another sign-in ends; no check while a redirect is sent
laijsg16b393a4fc010
diff --git a/src/components/EngineAccounts.tsx b/src/components/EngineAccounts.tsxindex 7d41e6a957..50fcf5a404 100644--- a/src/components/EngineAccounts.tsx+++ b/src/components/EngineAccounts.tsx@@ -210,7 +210,7 @@ function AccountRow({ group, instance, several, signingIn, onSignIn, onSignInDonconst [renaming, setRenaming] = useState(false);const signInButton = useRef<HTMLButtonElement>(null);const signInPanel = useRef<HTMLDivElement>(null);- const wasSigningIn = useRef(signingIn);+ const wasSigningIn = useRef(false);const state = accountState(instance);const account = instance.snapshot.account;// This server cannot run the provider's sign-in (a remote browser for a local-only flow): say why, offer nothing.@@ -228,7 +228,7 @@ function AccountRow({ group, instance, several, signingIn, onSignIn, onSignInDonuseEffect(() => {const opened = signingIn && !wasSigningIn.current, closed = !signingIn && wasSigningIn.current;wasSigningIn.current = signingIn;- if (closed) signInButton.current?.focus();+ if (closed && document.activeElement === document.body) signInButton.current?.focus();if (!opened) return;const frame = requestAnimationFrame(() => signInPanel.current?.querySelector<HTMLButtonElement>("button:not(:disabled)")?.focus());return () => cancelAnimationFrame(frame);diff --git a/src/components/EngineSetup.tsx b/src/components/EngineSetup.tsxindex a44978a9bd..71b7e5211d 100644--- a/src/components/EngineSetup.tsx+++ b/src/components/EngineSetup.tsx@@ -493,7 +493,7 @@ function ManagedEngineSetup({ instance, signInOnly, autoStart = false, onDone }:)}{flow && !flow.pastedCode && (<>- <button type="button" onClick={() => void check()} className="w-full rounded-lg bg-control px-3 py-2 text-[12px] font-semibold text-ink hover:bg-raised-hover">+ <button type="button" disabled={busy !== null} onClick={() => void check()} className="w-full rounded-lg bg-control px-3 py-2 text-[12px] font-semibold text-ink hover:bg-raised-hover disabled:opacity-50">{busy === "check" ? t("common.checking") : t("engineSetup.finishedSignIn")}</button><div data-redirect-paste className="rounded-lg border border-hairline/50 bg-app px-2.5 py-2 text-[12px] text-ink-secondary">@@ -517,7 +517,7 @@ function ManagedEngineSetup({ instance, signInOnly, autoStart = false, onDone }:</div></>)}- {error && <p className="text-[12px] text-danger">{error}</p>}+ {error && <p role="alert" className="text-[12px] text-danger">{error}</p>}{onDone && <button type="button" disabled={busy === "complete"} onClick={() => void cancel()} className="rounded-lg disabled:opacity-50 px-2.5 py-1.5 text-[12px] text-ink-secondary hover:bg-control">{t("common.cancel")}</button>}</div>);diff --git a/src/components/EnginesSettings.antigravity.dom.test.ts b/src/components/EnginesSettings.antigravity.dom.test.tsindex 8787550536..0036181c96 100644--- a/src/components/EnginesSettings.antigravity.dom.test.ts+++ b/src/components/EnginesSettings.antigravity.dom.test.ts@@ -86,6 +86,7 @@ async function pasteRedirect(instanceId: string) {input.dispatchEvent(new Event("input", { bubbles: true }));});}+const nextFrame = () => act(async () => { await new Promise<void>((resolve) => requestAnimationFrame(() => resolve())); });async function openSimpleCard() {await render("simple");await click(container.querySelector('[data-simple-engine="antigravity"] button') ?? undefined);@@ -185,6 +186,35 @@ describe("Google Gemini (Antigravity) accounts share one card", () => {expect(document.activeElement).toBe(buttons(row("antigravity"), "Sign in")[0]);});+ it("leaves focus where it is when another account's sign-in finishes", async () => {+ fixture.state.instances = [google("antigravity", "Personal", { authenticated: false }), google("antigravity-work", "Work", { authenticated: false })];+ await render();+ await click(buttons(row("antigravity"), "Sign in")[0]);+ await click(buttons(row("antigravity-work"), "Sign in")[0]);+ await nextFrame();+ const typing = row("antigravity-work").querySelector<HTMLInputElement>("[data-redirect-paste] input")!;+ typing.focus();+ await pasteRedirect("antigravity");+ await act(async () => { buttons(row("antigravity"), "Send redirect")[0]!.click(); });+ await nextFrame();+ expect(row("antigravity").querySelector("[data-account-sign-in]")).toBeNull();+ expect(document.activeElement).toBe(typing);+ });++ it("moves focus into the sign-in of an account just added", async () => {+ await render();+ await click(buttons(container, "Add Google account")[0]);+ const input = container.querySelector<HTMLInputElement>("form[data-add-account] input")!;+ await act(async () => {+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(input, "Work");+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+ await click(buttons(container, "Add and sign in")[0]);+ await render();+ await nextFrame();+ expect(row("antigravity-work").querySelector("[data-account-sign-in]")?.contains(document.activeElement)).toBe(true);+ });+it("keeps the sign-in open and says why when the server could not cancel it", async () => {fixture.state.instances = [google("antigravity", "Personal", { authenticated: false })];fixture.cancelFails = true;@@ -203,6 +233,7 @@ describe("Google Gemini (Antigravity) accounts share one card", () => {await pasteRedirect("antigravity");await click(buttons(row("antigravity"), "Send redirect")[0]);expect(buttons(row("antigravity"), "Cancel")[0]?.disabled).toBe(true);+ expect(buttons(row("antigravity"), "I finished signing in")[0]?.disabled).toBe(true);await act(async () => { send(); await fixture.completeGate; });});