# Dialog keyboard focus test report

> Read a local fixture that checks where keyboard focus returns after a dialog closes. Compare the observed target with the control that opened it.

Source: https://cueapril.com/reports/keyboard-focus-after-dialog
Updated: 2026-12-01
Index: https://cueapril.com/llms.txt

## Can a keyboard user continue the workflow from the original control?

The original implementation failed the “Second row edit button” check. Expected edit-row-2 and observed open. The corrected implementation met both expectations on the same inputs.

Closing a dialog restores focus to the control that opened it. Compare two versions of a small, runnable fixture. The inputs, expected values and recorded results are public.

## What the control case missed

An assertion that the first trigger receives focus passes when it happens to be the opener. Open from a second row instead and the generic default target steals the keyboard user's place.

Observed values from the two implementations

| Check | Expected | Original | Corrected |
| --- | --- | --- | --- |
| Default opener | open | open | open |
| Second row edit button | edit-row-2 | open | edit-row-2 |

## What to check before merging

Record the actual opening element and restore focus when it still exists. Run a separate browser and keyboard check for an opener removed during editing. The model below verifies the choice of target ID.

## Reproduce the recorded result

Download the [Node.js fixture](/examples/qa-regressions/run.mjs) and run node run.mjs keyboard-focus-after-dialog with Node.js 24. Compare the printed JSON with the [recorded results](/examples/qa-regressions/results.json). This is a locally executed model of the regression, using synthetic inputs. It covers the rule shown here. Hosted runs, browser behaviour and customer PRs require their own evidence.

## Primary documentation

- [Runnable synthetic regression fixtures](/examples/qa-regressions/run.mjs)
- [Recorded output for all twelve fixtures](/examples/qa-regressions/results.json)

By Cue April. Updated 2026-12-01.

## Related

- [Worked test reports](https://cueapril.com/reports): Replay a real mobile pricing defect from a Cue April pull request. Explore runnable reports for checkout, search, data migrations and other regressions.
- [Pull request testing](https://cueapril.com/use-cases/pull-request-testing): See what a pull request test report should show before you merge. Follow a failing checkout check through the fix and inspect a real PR report.
