From 226bc09b20011817325f8c48298555851dce4702 Mon Sep 17 00:00:00 2001 From: Khushi Jain Date: Wed, 11 Nov 2026 00:53:44 +0530 Subject: [PATCH] TEST: cover the Close button returning focus to the technique opener --- .../Scenarios/ScenarioRunPage.test.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/components/Scenarios/ScenarioRunPage.test.tsx b/frontend/src/components/Scenarios/ScenarioRunPage.test.tsx index b819cce051..1b8942bf1b 100644 --- a/frontend/src/components/Scenarios/ScenarioRunPage.test.tsx +++ b/frontend/src/components/Scenarios/ScenarioRunPage.test.tsx @@ -246,6 +246,22 @@ describe('ScenarioRunPage', () => { await waitFor(() => expect(details).toHaveFocus()) }) + it('restores focus to the technique opener when attack details are closed with the Close button', async () => { + const user = userEvent.setup() + render() + await expand(user) + const details = screen.getAllByRole('button', { name: /^Open details for PromptSendingAttack:/ })[0] + details.focus() + await user.keyboard('{Enter}') + const dialog = within(await screen.findByRole('dialog')) + await user.click(dialog.getByRole('button', { name: 'Close', exact: true })) + await waitFor(() => expect(details).toHaveFocus()) + await user.click(details) + await screen.findByRole('dialog') + await user.keyboard('{Escape}') + await waitFor(() => expect(details).toHaveFocus()) + }) + it('keeps canonical conversation navigation separate from row details', async () => { const user = userEvent.setup() render()