Skip to content

TEST: cover the Close button returning focus to the technique opener - #4191

Closed
Khushi (khushi-git-7) wants to merge 1 commit into
microsoft:mainfrom
khushi-git-7:test/3915-technique-close-focus
Closed

Khushi (khushi-git-7) wants to merge 1 commit into
microsoft:mainfrom
khushi-git-7:test/3915-technique-close-focus

Conversation

@khushi-git-7

Copy link
Copy Markdown
Contributor

Description

Closes #3915.

While picking up #3915 I found that the focus bug no longer reproduces on main: the separate Techniques dialog it describes has been replaced, and the attack details dialog now closes through closeAttemptDetails(), which already returns focus to the button that opened it. The existing tests cover opening by keyboard with the dismiss icon, and #3938 covers Escape, but nothing covered the dialog's Close button, so this PR adds that regression test.

  • New test in ScenarioRunPage.test.tsx: opens a technique's attack details from the keyboard, closes them with the Close button and checks focus is back on the opener, then reopens by click and closes with Escape and checks the same
  • No change to app code

Copilot AI balanced review requested due to automatic review settings November 11, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the test-only change covering technique-dialog focus restoration.

No open issues 🎉

What changed in this PR

Adds regression coverage for returning focus to the technique opener after closing attack details, complementing existing coverage related to #3915 and #3938. No application code changes.

Changes:

  • Tests keyboard opening followed by dismissal with the Close button and focus restoration.
  • Verifies reopening by click and dismissal with Escape also restores focus.
File Description
frontend/​src/​components/​Scenarios/​ScenarioRunPage.test.tsx Adds a technique-dialog focus-restoration test covering Close, reopening, and Escape.

Review effort: Balanced

@khushi-git-7

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@romanlutz Roman Lutz (romanlutz) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up — the test was correct and valuable when you wrote it (I verified it passes on your branch and fails if the focus-restore call is removed). Unfortunately it was overtaken by the scan results redesign (#4031 / #4032) that landed on main two days after you opened this PR, and it can't land in its current form:

  • The technique opener it queries (Open details for …) no longer exists on main — attack details now open from the table row (View attack details for … in AttackExecutionTable.tsx).
  • The attack-details dialog no longer has a Close button, only the dismiss icon (Close attack details in the new AttackDetailsDialog.tsx); the rewritten test file even asserts the Close button is absent from that dialog.
  • The focus-restore paths that remain are already covered by the rewritten ScenarioRunPage.test.tsx on main: row keyboard-open + dismiss close, row Escape, and the objective dialog's Close/Escape/reopen.

I merged current main into your branch locally to double-check: after resolving the textual conflict, the new test fails at its first query because the opener buttons are gone. So rather than asking you to rebase, I think the right call is to close this one — the gap it covered no longer exists.

If you'd like a landable follow-up against current main, one small case is still uncovered there: reopen-by-click + Escape from the attack row (the reopen variant is currently only tested for the objective opener). Happy to review that if you're interested.

@romanlutz

Copy link
Copy Markdown
Contributor

Closing per the review above: the scan results redesign (#4031/#4032) removed the technique opener and the dialog's Close button this test targets, and the rewritten test file on main covers the equivalent focus-restore paths. If you'd like a landable follow-up, the row reopen-by-click + Escape case mentioned in the review is still open — happy to review that against current main. Thanks again for the careful work here and on #3915.

@khushi-git-7

Copy link
Copy Markdown
Contributor Author

Thanks Roman Lutz (@romanlutz) for checking it against the redesign and explaining why it can't land. I've opened the reopen-by-click + Escape case for the attack row as #4434.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Saved-run technique and objective dialogs do not restore opener focus

3 participants