Skip to content

fix(frontend): restore keyboard focus to launch button on preview dismissal (#2680) - #2686

Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/scanner-preview-focus-restore
Open

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/scanner-preview-focus-restore

Conversation

@ManoharPaturi

Copy link
Copy Markdown

Description

Fixes #2680.

Dismissing Scanner's Run preview dialog via either the Cancel button or Escape key left document.activeElement on <body> rather than returning focus to the Launch scan button that opened the dialog.

This change:

  1. Retains a ref to the Launch scan button (launchButtonRef).
  2. Restores focus to the Launch scan button on non-submitting dismissal paths (onOpenChange when closing, and the Cancel button handler).
  3. Adds automated regression tests in ScenarioDetail.test.tsx covering focus restoration for both Cancel and Escape dismissal paths.

Validation

  • npm test -- ScenarioDetail.test.tsx (43/43 tests pass)
  • npm run type-check passes
  • npm run lint passes with 0 warnings
  • Signed-off with DCO

…missal (microsoft#2680)

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 17, 2026 07:12

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Scanner run preview dismissal does not restore keyboard focus

2 participants