@devries-cameron20 / t3code-1 / commits / b1619f3a74
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): cancelling update everything no longer flashes the update button's focus ring and tooltip (#25774)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 26, 2026 at 22:18 UTC b1619f3a74cb228356a3ea3f58573f88da270817
2 files changed +40 -5
apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx
+38 -3
@@ -1,7 +1,8 @@
1 import type { DesktopUpdateState } from "@t3tools/contracts";
2 import { describe, expect, it, vi } from "vite-plus/test";
3 -import { userEvent } from "vite-plus/test/browser";
3 +import { page, userEvent } from "vite-plus/test/browser";
4
5 +import "~/index.css";
6 import { act, render } from "../../../test/render";
7 import { SidebarUpdatePill } from "./SidebarUpdatePill";
8
@@ -9,6 +10,7 @@ const mocks = vi.hoisted(() => {
10 const listeners = new Set<() => void>();
11 return {
12 update: null as DesktopUpdateState | null,
13 + hasUpdates: false,
14 subscribe: (listener: () => void) => {
15 listeners.add(listener);
16 return () => listeners.delete(listener);
@@ -32,7 +34,13 @@ vi.mock("../../env", async (importOriginal) => ({
34 isElectron: true,
35 }));
36 vi.mock("./useUpdateEverything", () => ({
35 - useUpdateEverything: () => ({ hasUpdates: false, summary: "", lines: [], restarts: [] }),
37 + useUpdateEverything: () => ({
38 + hasUpdates: mocks.hasUpdates,
39 + summary: "Update everything",
40 + lines: [],
41 + restarts: [],
42 + skipped: [],
43 + }),
44 }));
45
46 function nightlyUpdate(releaseNotes: DesktopUpdateState["releaseNotes"]): DesktopUpdateState {
@@ -60,8 +68,9 @@ const RELEASE_NOTES: DesktopUpdateState["releaseNotes"] = [
68 { version: "0.0.50-nightly.2", items: ["Faster sidebar."], totalItems: 1 },
69 ];
70
63 -function setup(update: DesktopUpdateState | null) {
71 +function setup(update: DesktopUpdateState | null, { hasUpdates = false } = {}) {
72 mocks.update = update;
73 + mocks.hasUpdates = hasUpdates;
74 }
75
76 function publish(update: DesktopUpdateState | null) {
@@ -94,3 +103,29 @@ describe("SidebarUpdatePill release notes", () => {
103 await vi.waitFor(() => expect(releaseNotes()).not.toBeNull());
104 });
105 });
106 +
107 +describe("SidebarUpdatePill update everything", () => {
108 + it("does not refocus the update button after a pointer cancel", async () => {
109 + setup(null, { hasUpdates: true });
110 + await using screen = await render(<SidebarUpdatePill />);
111 + const button = screen.getByRole("button", { name: "Update everything" });
112 + await userEvent.click(button);
113 + const cancel = page.getByRole("button", { name: "Cancel" });
114 + await expect.element(cancel).toBeVisible();
115 +
116 + await userEvent.click(cancel);
117 + await vi.waitFor(() => expect(document.querySelector('[role="alertdialog"]')).toBeNull());
118 + expect(document.activeElement).not.toBe(button.element());
119 + });
120 +
121 + it("returns focus to the update button after Escape", async () => {
122 + setup(null, { hasUpdates: true });
123 + await using screen = await render(<SidebarUpdatePill />);
124 + const button = screen.getByRole("button", { name: "Update everything" });
125 + await userEvent.click(button);
126 + await expect.element(page.getByRole("button", { name: "Cancel" })).toBeVisible();
127 +
128 + await userEvent.keyboard("{Escape}");
129 + await vi.waitFor(() => expect(document.activeElement).toBe(button.element()));
130 + });
131 +});
apps/web/src/components/sidebar/UpdateEverythingDialog.tsx
+2 -2
@@ -51,8 +51,8 @@ export function UpdateEverythingDialog({
51 }: UpdateEverythingDialogProps) {
52 return (
53 <AlertDialog open={open} onOpenChange={onOpenChange}>
54 - <AlertDialogPopup>
55 - {}
54 + {/* Refocusing the trigger after a pointer close shows its focus ring and opens its tooltip. */}
55 + <AlertDialogPopup finalFocus={(closeType) => closeType === "keyboard"}>
56 <UpdateEverythingDialogContent {...content} />
57 </AlertDialogPopup>
58 </AlertDialog>