Restore focus after selecting dashboard menu items - #18862
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e873eb1-f464-47b9-8eed-0d2dd7b2fe43
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18862Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18862" |
There was a problem hiding this comment.
Pull request overview
Makes keyboard-focus restoration the default for dashboard button menus.
Changes:
- Defaults
AspireMenuButtonto restore trigger focus. - Restores focus before item callbacks run.
- Updates component tests for default and opt-out behavior.
Show a summary per file
| File | Description |
|---|---|
AspireMenuButton.razor.cs |
Enables focus restoration by default. |
AspireMenu.razor.cs |
Reorders focus restoration before callbacks. |
AspireMenuTests.cs |
Tests default restoration, ordering, and opt-out. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Medium
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
No issues found. Reviewed the focus-restoration ordering, all AspireMenuButton call sites, the separate context-menu behavior, and regression coverage.
Covers the structured logs "Remove data" menu, an AspireMenuButton that relies on the new default rather than opting in explicitly. Verified to fail when RestoreFocusOnItemClick defaults back to false. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f9959eed-3415-4f0b-a9b4-3a2a1c87328b
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
The azure-cosmos-emulator:stable image has a baked-in evaluation expiry
that has now passed, so the container exits with code 1 on start:
Error: The evaluation period has expired.
./cosmosdb-emulator: ERROR: PAL initialization failed. Error: 104
This fails deterministically on every run and blocks unrelated PRs, so
disable it until a refreshed image is published.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f9959eed-3415-4f0b-a9b4-3a2a1c87328b
Description
Selecting an item from a dashboard button menu can leave keyboard focus on the page body. #17926 fixed the original Resources View Options case, but similar
AspireMenuButtoncontrols still reproduce the same issue.This makes focus restoration the default for button-anchored menus. The trigger is focused before the item callback runs so callbacks that open a dialog or move focus elsewhere keep their intended focus.
User-facing usage
After selecting an item from a dashboard button menu, keyboard focus returns to the button that opened the menu instead of being lost.
Screenshots / Recordings
Grabacion.de.pantalla.2026-07-22.a.la.s.11.58.15.a.m.mov
Validation:
Aspire.Dashboard.Components.Tests(185 passed).Fixes #17656
Checklist
<remarks />and<code />elements on your triple slash comments?