Restore focus after selecting dashboard menu items#18862
Open
adamint wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2e873eb1-f464-47b9-8eed-0d2dd7b2fe43
Contributor
|
🚀 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" |
Contributor
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
Contributor
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
JamesNK
approved these changes
Jul 24, 2026
JamesNK
left a comment
Member
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.
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.
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?