Scanner run preview dismissal does not restore keyboard focus
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- playwright, typescript
- Área
- accessibility, frontend, testing-qa
Línea de trabajo
Comienza en frontend/src/components/Scenarios/ScenarioDetail.tsx, en el estado del diálogo de vista previa, onOpenChange y el controlador de Cancel. Ejecuta la prueba focalizada de Playwright para la desestimación descrita en el issue para Cancel y Escape, y luego añade cobertura de regresión que muestre que ambas rutas restauran el foco en el botón con data-testid="launch-scenario-btn".
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Dismissing Scanner's Run preview dialog with either Cancel or Escape leaves document.activeElement on <body> instead of returning focus to the Launch scan button that opened the modal.
The dialog initially receives and contains focus correctly. The defect is specific to focus restoration after dismissal. Keyboard users lose their point of reference and must navigate back to the launch workflow before continuing.
A search of currently open issues and pull requests using Scanner, run preview, dialog, focus restoration, and keyboard terms found no exact tracker. #2653 discusses decomposing ScenarioDetail while preserving accessibility, but it does not describe this behavior.
The relevant state-controlled dialog is in frontend/src/components/Scenarios/ScenarioDetail.tsx:1216-1223,1228-1234,1322-1327. Both onOpenChange and the Cancel handler close the dialog by updating previewOpen; neither path restores focus to the launch control.
Steps/Code to Reproduce
- Open Scanners and select
airt.jailbreak. - Select any configured compatible target.
- Select baseline plus
prompt_sending, setnum_jailbreaks=1,num_jailbreak_attempts=1, and set the maximum dataset size to 1. - Activate Launch scan to open Run preview.
- Select Cancel, wait for the dialog to close, and inspect
document.activeElement. - Reopen Run preview, dismiss it with Escape, and inspect
document.activeElementagain.
The focused Playwright probe used for both dismissal paths was:
await page.getByRole('button', { name: 'Cancel' }).click()
await page.waitForTimeout(300)
const activeElement = await page.evaluate(() => ({
tag: document.activeElement?.tagName,
testId: document.activeElement?.getAttribute('data-testid'),
ariaLabel: document.activeElement?.getAttribute('aria-label'),
}))
// { tag: 'BODY', testId: null, ariaLabel: null }
The same result reproduced after pressing Escape.
Expected Results
After either Cancel or Escape closes Run preview, focus returns to the Launch scan button (data-testid="launch-scenario-btn") that opened the dialog.
Actual Results
After both dismissal paths:
document.activeElement.tagName: BODY
data-testid: null
aria-label: null
The behavior reproduced in two focused runs with a 300 ms wait after dismissal. No scan was launched.
A likely fix is to retain a ref to the launch button and restore focus after every non-submitting dismissal path, with regression coverage for both Cancel and Escape.
Screenshots
N/A. The modal renders correctly; the failure is the programmatic focus position after it closes. The exact active-element result is included above.
Versions
- OS: Windows_NT
- Browser: Playwright Chromium (
@playwright/test1.62.1) - Python: 3.14.4
- PyRIT:
1.2.0.dev0,mainatb0dba3edd0abc2a88c15a5e8ebd106fe8396d27d - Python package versions: repository
uv.lockat the tested commit
- Lenguaje dominante
- Python
- Estrellas
- 4.5k
- Forks
- 896
- Merge medio
- 3 d 7 h
- PR fusionados (30 d)
- 155
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/PyRIT
-
Bug: triage help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
BUG: ScorerMetrics.to_json() raises TypeError on the trial_scores array ScorerEvaluator attaches Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
-
Bug: triage help wanted
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
-
BUG Console printers write ANSI/OSC sequences from target responses straight to the terminal Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Todos los issues de microsoft/PyRIT
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100