Fix stack overflow when opening child dialog from notification center#17261
Open
JamesNK wants to merge 4 commits into
Open
Fix stack overflow when opening child dialog from notification center#17261JamesNK wants to merge 4 commits into
JamesNK wants to merge 4 commits into
Conversation
Disable TrapFocus on the notifications center dialog because it launches child dialogs. When multiple dialogs trap focus simultaneously, a recursive focus loop occurs causing 'Maximum call stack size exceeded' errors. Fixes #16593
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17261Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17261" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a dashboard runtime error (RangeError: Maximum call stack size exceeded) triggered when opening a child dialog (“View Response”) from within the Notifications Center dialog, caused by nested Fluent UI focus traps.
Changes:
- Disables focus trapping on the Notifications Center dialog to avoid infinite recursion when child dialogs open.
- Adds a
FluentDialogcascading parameter toNotificationEntryComponentto provide access to the parent dialog context.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Aspire.Dashboard/Components/Layout/MainLayout.razor.cs | Changes Notifications Center dialog parameters to set TrapFocus = false. |
| src/Aspire.Dashboard/Components/Dialogs/NotificationEntryComponent.razor.cs | Adds a FluentDialog cascading parameter to access the parent dialog context. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
❓ CLI E2E Tests unknown — 92 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26111508088 |
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.
Summary
Fixes #16593
When clicking "View Response" from the Notifications Center dialog, a child dialog (TextVisualizer) opens. Because both dialogs have focus trapping enabled, the Fluent UI focus-trap handlers recurse infinitely between them, causing
RangeError: Maximum call stack size exceeded.Fix
Hide the parent notification center dialog while the child dialog is open, then restore it after the child closes. This prevents multiple dialogs from competing for focus simultaneously.
Changes
finallyblock after the child dialog closes.IDialogReferencefromOpenDialogAsyncso callers can await the dialog's completion.OnClickdoesn't return until the child dialog is closed. UseConfigureAwait(true)to stay on the Blazor sync context.Testing
Manually verified that:
finally)