Not possible to close multiple nested dialogs using the Escape key #889

Closed
opened 2026-01-29 17:45:51 +00:00 by claunia · 0 comments
Owner

Originally created by @djcsavoy on GitHub (Jun 15, 2023).

Describe the bug
If you have multiple nested dialogs open (i.e. from within one dialog, open another one), and both have the CloseOnEsc behaviour - which is the default - closing one dialog using the Escape key seems to remove the handler so you can't close the remaining dialog(s) using escape.

To Reproduce
Paste the following Blazor code into a page:

<button @onclick="ClickMe">Click me</button>

@code {
    public async Task ClickMe() {
        bool? result = await DialogService.OpenAsync("Test", ds =>
            @<div>
                <button @onclick="ClickMe">Open Nested</button>
            </div>
             );
    }
}

If you open a dialog, then click Open Nested to open a second dialog on top of the first, this will exhibit the problem. You can close the nested dialogs successfully using mouse controls, but Escape will only close one of them.

Expected behavior
Escape should work to close all the open dialogs in turn, so you can closing multiple dialogs using the keyboard, not just the mouse.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Edge
  • Version: 114

Additional context
N/A

Originally created by @djcsavoy on GitHub (Jun 15, 2023). **Describe the bug** If you have multiple nested dialogs open (i.e. from within one dialog, open another one), and both have the CloseOnEsc behaviour - which is the default - closing one dialog using the Escape key seems to remove the handler so you can't close the remaining dialog(s) using escape. **To Reproduce** Paste the following Blazor code into a page: ``` <button @onclick="ClickMe">Click me</button> @code { public async Task ClickMe() { bool? result = await DialogService.OpenAsync("Test", ds => @<div> <button @onclick="ClickMe">Open Nested</button> </div> ); } } ``` If you open a dialog, then click Open Nested to open a second dialog on top of the first, this will exhibit the problem. You can close the nested dialogs successfully using mouse controls, but Escape will only close one of them. **Expected behavior** Escape should work to close all the open dialogs in turn, so you can closing multiple dialogs using the keyboard, not just the mouse. **Screenshots** N/A **Desktop (please complete the following information):** - OS: Windows 11 - Browser: Edge - Version: 114 **Additional context** N/A
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#889