Hi, I have a dialog opened with DialogService.OpenAsync with new DialogOptions() { Resizable = true, Draggable = true, CloseDialogOnEsc = false });
By setting CloseDialogOnEsc = false I expect to avoid closing the dialog by hitting Esc key, but it still closes.
Might it be I'm doing something wrong or I should do something else to avoid closing a dialog when Esc key is pressed?
Hi @enchev,
Thank you for the quick response!
I downloaded the latest source code from GitHub but I can't compile it. I'm using the latest version of VS 2022 Community and I don't see any problems in dependencies. Radzen.Blazor project builds successfully but RadzenBlazorDemos is giving me all kinds of odd errors like "'IServiceCollection' does not contain a definition for 'AddRazorPages'..." in Startup.cs or not recognizing @page and @code in razor file.
Can you please provide me with an advice?
Thank you. I see you're using version 17.5.0 Preview 1 of VS 2022 while mine is the latest official 17.4.1 but no clue if that is the cause of the errors which I'm facing...
You might need to check Microsoft Blazor page to get the right tools for Blazor development with .NET 7:
I found the problem - old files left in the project. Sorry for bothering you...
I'll continue testing for the dialog closing issue...
Finally, problem which was the reason for this topic is resolved. The unexpected behavior was caused by opening a second (busy) dialog on top of the first dialog without setting CloseDialogOnEsc to false for the second. This way it adds again the document's keydown JS event listener where closing of the first dialog happens on Esc key down.
The moral: if you want to prevent a dialog from closing on pressing Esc key, set CloseDialogOnEsc option to false when opening this dialog and every other dialog, if any, on top of it.