diff --git a/apps/web/src/components/settings/UpdateTrackSwitchDialog.tsx b/apps/web/src/components/settings/UpdateTrackSwitchDialog.tsx index fd844977b81f5..659cf6481f373 100644 --- a/apps/web/src/components/settings/UpdateTrackSwitchDialog.tsx +++ b/apps/web/src/components/settings/UpdateTrackSwitchDialog.tsx @@ -27,16 +27,16 @@ import { nothingToMove, prepareLocalTrackSwitch, } from "./updateTrackSwitch.logic"; -import { - AlertDialog, - AlertDialogClose, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogPopup, - AlertDialogTitle, -} from "../ui/alert-dialog"; import { Button } from "../ui/button"; +import { + Dialog, + DialogClose, + DialogDescription, + DialogFooter, + DialogHeader, + DialogPopup, + DialogTitle, +} from "../ui/dialog"; import { stackedThreadToast, toastManager } from "../ui/toast"; /** Moves this app and every connected machine to `channel`. */ @@ -56,15 +56,15 @@ export function UpdateTrackSwitchDialog({ } const label = channelSwitchLabel(channel, m); return ( - !open && onClose()}> - - - + !open && onClose()}> + + + Switch to {label} - - + + {AsyncResult.isFailure(release) ? npmReleaseFailureMessage(release.cause, m) : AsyncResult.isSuccess(release) @@ -75,15 +75,15 @@ export function UpdateTrackSwitchDialog({ }, ) : gt("Checking releases…")} - - - - }> + + + + }> Cancel - - - - + + + + ); } diff --git a/apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx b/apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx index 0f751bc52aef6..78cf4ccd8aeb1 100644 --- a/apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx +++ b/apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx @@ -126,15 +126,17 @@ describe("SidebarUpdatePill release notes", () => { }); describe("SidebarUpdatePill update everything", () => { - it("does not refocus the update button after a pointer cancel", async () => { + it.each([ + ["Cancel", () => userEvent.click(page.getByRole("button", { name: "Cancel" }))], + ["an outside press", () => userEvent.click(document.body, { position: { x: 1, y: 1 } })], + ])("closes without refocusing the update button after %s", async (_closer, close) => { setup(null, { hasUpdates: true }); await using screen = await render(); const button = screen.getByRole("button", { name: "Update everything" }); await userEvent.click(button); - const cancel = page.getByRole("button", { name: "Cancel" }); - await expect.element(cancel).toBeVisible(); + await expect.element(page.getByRole("alertdialog")).toBeVisible(); - await userEvent.click(cancel); + await close(); await vi.waitFor(() => expect(document.querySelector('[role="alertdialog"]')).toBeNull()); expect(document.activeElement).not.toBe(button.element()); }); diff --git a/apps/web/src/components/sidebar/UpdateEverythingDialog.tsx b/apps/web/src/components/sidebar/UpdateEverythingDialog.tsx index 048aa54ae620a..3750305ac66a6 100644 --- a/apps/web/src/components/sidebar/UpdateEverythingDialog.tsx +++ b/apps/web/src/components/sidebar/UpdateEverythingDialog.tsx @@ -6,17 +6,17 @@ import { msg, T, useGT, useMessages } from "gt-react"; import { Fragment, type RefObject, useRef } from "react"; import { environmentThreadShells } from "~/state/threads"; -import { - AlertDialog, - AlertDialogClose, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogPopup, - AlertDialogTitle, -} from "../ui/alert-dialog"; import { Button } from "../ui/button"; import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "../ui/collapsible"; +import { + Dialog, + DialogClose, + DialogDescription, + DialogFooter, + DialogHeader, + DialogPopup, + DialogTitle, +} from "../ui/dialog"; import { MiddleTruncate } from "../ui/middle-truncate"; import { ScrollArea } from "../ui/scroll-area"; import type { RestartingMachine, UpdateEverythingRow } from "./updateEverything.logic"; @@ -74,16 +74,18 @@ export function UpdateEverythingDialog({ }: UpdateEverythingDialogProps) { const cancelRef = useRef(null); return ( - + {/* Refocusing the trigger after a pointer close shows its focus ring and opens its tooltip. */} - closeType === "keyboard"} > - - + + ); } @@ -132,14 +134,14 @@ function UpdateEverythingDialogContent({ return ( <> - - + + {title ?? gt("{count, plural, one {Update {count} machine?} other {Update {count} machines?}}", { count: updating.length, })} - - + + {version !== null ? ( <> T3 Code {version} @@ -155,8 +157,8 @@ function UpdateEverythingDialogContent({ {checking ? `${version !== null || providerCount > 0 ? " · " : ""}${gt("Checking for more…")}` : null} - - + + {notes.map((note) => ( @@ -245,7 +247,7 @@ function UpdateEverythingDialogContent({ ) : null} - + {disabledReason !== null ? ( {disabledReason} @@ -271,13 +273,13 @@ function UpdateEverythingDialogContent({ )}`} ) : null} - }> + }> Cancel - + {confirmLabel ?? gt("Update", { $context: "verb, confirms the update" })} - + > ); }
{disabledReason} @@ -271,13 +273,13 @@ function UpdateEverythingDialogContent({ )}`}