From ea5dd9e2ad6cec1de0a4ff170e196d91f18ea2c3 Mon Sep 17 00:00:00 2001 From: agent Date: Wed, 18 Nov 2026 05:31:16 +0000 Subject: [PATCH 1/6] Return focus to RecordActionsMenu's More actions button after a confirmation (#66, 6.1) Co-Authored-By: Claude Opus 5.5 --- .changeset/record-actions-menu-focus.md | 5 +++++ .../listing/record-actions-menu.test.tsx | 14 +++++++++++++- .../src/components/listing/record-actions-menu.tsx | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .changeset/record-actions-menu-focus.md diff --git a/.changeset/record-actions-menu-focus.md b/.changeset/record-actions-menu-focus.md new file mode 100644 index 000000000..bfee58703 --- /dev/null +++ b/.changeset/record-actions-menu-focus.md @@ -0,0 +1,5 @@ +--- +"@javaabu/onu": patch +--- + +`RecordActionsMenu` now returns focus to the "More actions" button when a confirmation opened from its menu closes, instead of leaving it on the page body. diff --git a/packages/onu/src/components/listing/record-actions-menu.test.tsx b/packages/onu/src/components/listing/record-actions-menu.test.tsx index 7f96698e9..ce83ba506 100644 --- a/packages/onu/src/components/listing/record-actions-menu.test.tsx +++ b/packages/onu/src/components/listing/record-actions-menu.test.tsx @@ -1,4 +1,4 @@ -import { screen, within } from "@testing-library/react" +import { screen, waitFor, within } from "@testing-library/react" import userEvent from "@testing-library/user-event" import { afterEach, describe, expect, it, vi } from "vitest" @@ -40,6 +40,18 @@ describe("RecordActionsMenu", () => { expect(await screen.findByRole("alertdialog", { name: "Delete Jane Doe?" })).toBeInTheDocument() }) + it("returns focus to the More actions button when a confirmation from the menu closes", async () => { + setMobile(false) + renderWithOnu() + const trigger = screen.getByRole("button", { name: "More actions" }) + await userEvent.click(trigger) + await userEvent.click(await screen.findByRole("menuitem", { name: "Delete" })) + await screen.findByRole("alertdialog", { name: "Delete Jane Doe?" }) + await userEvent.click(screen.getByRole("button", { name: "Cancel" })) + await waitFor(() => expect(screen.queryByRole("alertdialog")).not.toBeInTheDocument()) + expect(trigger).toHaveFocus() + }) + it("asks before a risky button action", async () => { setMobile(false) renderWithOnu() diff --git a/packages/onu/src/components/listing/record-actions-menu.tsx b/packages/onu/src/components/listing/record-actions-menu.tsx index b92581647..2c9cf95d7 100644 --- a/packages/onu/src/components/listing/record-actions-menu.tsx +++ b/packages/onu/src/components/listing/record-actions-menu.tsx @@ -84,6 +84,7 @@ export function RecordActionsMenu({ @@ -249,6 +275,10 @@ export function BulkActionBar({ {visible.map((action) => (