Skip to content

Commit 86d8c8f

Browse files
author
PR Batch Tester
committed
fix(web): make update interruption warnings accessible
1 parent 7f9ca04 commit 86d8c8f

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

‎apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ describe("SidebarUpdatePill update everything", () => {
171171
await userEvent.click(screen.getByRole("button", { name: "Update everything" }));
172172
const dialog = page.getByRole("alertdialog");
173173
await expect.element(dialog.getByText(interruption)).toBeVisible();
174+
await expect.element(dialog).toHaveAccessibleDescription(interruption);
175+
await expect
176+
.element(dialog.getByText(/Tool calls in progress will not resume/))
177+
.toBeVisible();
174178

175179
await userEvent.click(dialog.getByRole("button", { name: choice, exact: true }));
176180
await vi.waitFor(() => expect(document.querySelector('[role="alertdialog"]')).toBeNull());

‎apps/web/src/components/sidebar/UpdateEverythingDialog.tsx‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useAtomValue } from "@effect/atom-react";
22
import { EnvironmentId } from "@t3tools/contracts";
33
import { Atom } from "effect/reactivity";
44
import { ChevronRightIcon } from "lucide-react";
5-
import { Fragment, type RefObject, useRef } from "react";
5+
import { Fragment, type RefObject, useId, useRef } from "react";
66

77
import { environmentThreadShells } from "~/state/threads";
88
import {
@@ -54,6 +54,7 @@ type UpdateEverythingDialogContentProps = Omit<
5454
"open" | "onOpenChange"
5555
> & {
5656
readonly cancelRef: RefObject<HTMLButtonElement | null>;
57+
readonly descriptionId: string;
5758
};
5859

5960
export function UpdateEverythingDialog({
@@ -62,15 +63,25 @@ export function UpdateEverythingDialog({
6263
...content
6364
}: UpdateEverythingDialogProps) {
6465
const cancelRef = useRef<HTMLButtonElement>(null);
66+
const descriptionId = useId();
6567
return (
6668
<AlertDialog open={open} onOpenChange={onOpenChange}>
6769
{/* Refocusing the trigger after a pointer close shows its focus ring and opens its tooltip. */}
6870
<AlertDialogPopup
6971
className="sm:max-w-xl"
72+
aria-describedby={
73+
content.rows.some((row) => row.app !== null)
74+
? `${descriptionId} ${descriptionId}-interruption`
75+
: descriptionId
76+
}
7077
initialFocus={cancelRef}
7178
finalFocus={(closeType) => closeType === "keyboard"}
7279
>
73-
<UpdateEverythingDialogContent {...content} cancelRef={cancelRef} />
80+
<UpdateEverythingDialogContent
81+
{...content}
82+
cancelRef={cancelRef}
83+
descriptionId={descriptionId}
84+
/>
7485
</AlertDialogPopup>
7586
</AlertDialog>
7687
);
@@ -89,6 +100,7 @@ function UpdateEverythingDialogContent({
89100
restarts,
90101
onConfirm,
91102
cancelRef,
103+
descriptionId,
92104
}: UpdateEverythingDialogContentProps) {
93105
const stopped = useAtomValue(
94106
runningThreadCountAtom(
@@ -118,7 +130,7 @@ function UpdateEverythingDialogContent({
118130
<AlertDialogTitle>
119131
Update {updating.length} {updating.length === 1 ? "machine" : "machines"}?
120132
</AlertDialogTitle>
121-
<AlertDialogDescription>
133+
<AlertDialogDescription id={descriptionId}>
122134
{version !== null ? (
123135
<>
124136
T3 Code <span className="font-mono text-xs">{version}</span>
@@ -199,8 +211,12 @@ function UpdateEverythingDialogContent({
199211
{/* Thread counts come from client snapshots that can still be loading, so the warning
200212
cannot depend on them. */}
201213
{updating.some((row) => row.app !== null) ? (
202-
<p className="self-center text-muted-foreground text-sm max-sm:order-1 max-sm:text-center sm:mr-auto">
203-
Running tasks and tool calls will be interrupted.
214+
<p
215+
id={`${descriptionId}-interruption`}
216+
className="self-center text-muted-foreground text-sm max-sm:order-1 max-sm:text-center sm:mr-auto"
217+
>
218+
Running tasks and tool calls will be interrupted. Tool calls in progress will not
219+
resume.
204220
{running === 0
205221
? null
206222
: stopped === 0

0 commit comments

Comments
 (0)