diff --git a/webui/src/components/settings/system/AutomationsSettings.tsx b/webui/src/components/settings/system/AutomationsSettings.tsx index 7bb14584c..705302b39 100644 --- a/webui/src/components/settings/system/AutomationsSettings.tsx +++ b/webui/src/components/settings/system/AutomationsSettings.tsx @@ -553,7 +553,8 @@ function AutomationDetailPanel({ {actionKey === `${job.enabled ? "disable" : "enable"}:${job.id}` ? : null} {job.enabled ? tx("settings.automations.pause", "Pause") : tx("settings.automations.resume", "Resume")} - + {/* The detail dialog owns modality, including during the delete handoff. */} + + { if (!open) setPending(null); }} + onConfirm={(job) => { + setJobs((items) => items.filter((item) => item.id !== job.id)); + setPending(null); + }} /> + + ; + } + render(); + await user.click(screen.getByRole("button", { name: /PR watch/ })); + const detail = screen.getByRole("dialog", { name: "PR watch" }); + await user.click(screen.getByRole("button", { name: "More actions" })); + expect(document.body.style.pointerEvents).toBe("none"); + await user.click(screen.getByRole("menuitem", { name: "Delete" })); + expect(detail).toHaveAttribute("data-state", "closed"); + finishExit(detail); + const confirmation = await screen.findByRole("dialog", { name: "Delete automation" }); + expect(document.body.style.pointerEvents).toBe("none"); + await user.click(within(confirmation).getByRole("button", { name: operation, exact: true })); + finishExit(confirmation); + await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument()); + expect(document.body.style.pointerEvents).not.toBe("none"); + await user.click(screen.getByRole("button", { name: "Sidebar Apps" })); + expect(navigate).toHaveBeenCalledOnce(); + expect(screen.queryByRole("button", { name: /PR watch/ }) !== null).toBe(operation === "Cancel"); + }); + it("returns keyboard focus to the task after cancelling or saving the real editor", async () => { const user = userEvent.setup(); const save = vi.fn();