Repository navigation
Restore opener focus for saved-run objective dialog (Escape and reopen) - #3938
Merged
Roman Lutz (romanlutz) merged 2 commits intoNov 8, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the dialog focus-restoration change.
No open issues 🎉
What changed in this PR
Restores keyboard focus to the opening objective button when saved-run Objective details are dismissed, addressing the objective-dialog portion of #3915.
Changes:
- Routes objective-dialog closure through a handler that restores focus on the next animation frame, provided the opener remains connected.
- Adds regression tests for objective Close, Escape, and reopening, plus Escape focus restoration for technique attack details.
| File | Description |
|---|---|
frontend/src/components/Scenarios/ScenarioRunPage.tsx |
Adds and wires the objective-dialog focus restoration handler. |
frontend/src/components/Scenarios/ScenarioRunPage.test.tsx |
Adds focus restoration coverage for objective and technique dialogs. |
Review effort: Balanced
Roman Lutz (romanlutz)
approved these changes
Nov 8, 2026
Roman Lutz (romanlutz)
enabled auto-merge
November 8, 2026 07:23
Roman Lutz (romanlutz)
approved these changes
Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Closing the saved-run Objectives detail dialog did not return keyboard focus to the objective button that opened it.
The change
This change adds regression tests for the objective dialog's focus behaviour. It also changes
ScenarioRunPage.tsx, which addscloseObjectiveand rewiresonCloseto it. The fix in the prior commit (closeObjectiverestores focus toobjectiveTriggerafter the dialog closes) covers Close and Escape, since both route throughonClose.How it was tested
cd frontend && npx jest src/components/Scenarios/ScenarioRunPage.test.tsx -t "restores focus": 4 passed.cd frontend && npx jest src/components/Scenarios/ScenarioRunPage.test.tsx: 37 passed.ScenarioRunPage.tsxfrom the base commit, the same-t "restores focus"run exited 1 with 2 failed and 2 passed.Not verified: real-browser focus behaviour (jsdom only), and the Techniques dialog path beyond its existing jsdom test. The issue's original repro used a headed/headless Chrome setup that was not rerun here.
Regression test: fails on base twice (/Expected element with focus/), passes on fix twice (
cd frontend && npx jest src/components/Scenarios/ScenarioRunPage.test.tsx -t "restores focus to the objective opener")Refs #3915