From a2e33893e1ca95f5a06af86ec2438ef3c5958540 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Fri, 11 Sep 2026 21:15:27 +0800 Subject: [PATCH] fix(webui): restore navigation after automation deletion Let the automation detail dialog own the background interaction lock instead of nesting a second modal menu. Overlapping exit lifecycles during deletion could leave body pointer events disabled after all dialogs closed. Cover confirmed and cancelled deletion with animated Radix lifecycle tests and assert that sidebar navigation works after dismissal. Refs NAN-117. --- .../settings/system/AutomationsSettings.tsx | 3 +- webui/src/tests/automations-settings.test.tsx | 64 ++++++++++++++++++- 2 files changed, 64 insertions(+), 3 deletions(-) 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();