Repository navigation
TEST: cover the Close button returning focus to the technique opener - #4191
Khushi (khushi-git-7) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 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
|
@microsoft-github-policy-service agree |
Roman Lutz (romanlutz)
left a comment
There was a problem hiding this comment.
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 …inAttackExecutionTable.tsx). - The attack-details dialog no longer has a
Closebutton, only the dismiss icon (Close attack detailsin the newAttackDetailsDialog.tsx); the rewritten test file even asserts theClosebutton is absent from that dialog. - The focus-restore paths that remain are already covered by the rewritten
ScenarioRunPage.test.tsxon 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.
|
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. |
|
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. |
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 throughcloseAttemptDetails(), 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.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