Completed
Last Updated: 02 May 2022 12:28 by ADMIN
Release 3.3.0
Mark
Created on: 13 Apr 2021 07:19
Category: Dialog
Type: Bug Report
12
Predefined Dialogs don't cover a modal dialog when the TelerikRootComponent parent does not have display:flex

ADMIN EDIT

You can use the code snippet below to test this behavior in your app. At the end of the post you will find two sample apps attached that use that same code - one is OK, the other exhibits the issue. The difference in them is the layout. The one that works OK has the old MS template from over a year ago where there is an <app> element above the root of the blazor components, and that element has display: flex. The problematic app has the newer template without such a parent element - the parent element is not the <body> and it does not have display:flex. You can add in the following rule to it to see it will fix the dialog overlay error (but it can damage the layout of the app).

sample rule to fix the issue in the problematic app

    body {
        display:flex;
    }

sample code to test the behavior

<TelerikWindow Modal="true" @bind-Visible="@isModalVisible">
    <WindowTitle>
        <strong>The Title</strong>
    </WindowTitle>
    <WindowContent>
        I am modal so the page behind me is not available to the user.
        <br />
        <TelerikButton OnClick="@( _ => isSecondModalVisible = true )">Open the SECOND window</TelerikButton>
        <TelerikButton OnClick="@ShowConfirmWithTitle">Show Confirm</TelerikButton>
    </WindowContent>
    <WindowActions>
        <WindowAction Name="Minimize" />
        <WindowAction Name="Maximize" />
        <WindowAction Name="Close" />
    </WindowActions>
</TelerikWindow>

<TelerikWindow Modal="true" @bind-Visible="@isSecondModalVisible">
    <WindowTitle>
        <strong>The SECOND</strong>
    </WindowTitle>
    <WindowContent>
        Second modal!
    </WindowContent>
    <WindowActions>
        <WindowAction Name="Minimize" />
        <WindowAction Name="Maximize" />
        <WindowAction Name="Close" />
    </WindowActions>
</TelerikWindow>

<TelerikButton OnClick="@( _ => isModalVisible = true )">Open the window</TelerikButton>

@code{
    [CascadingParameter]
    public DialogFactory Dialogs { get; set; }
    bool isModalVisible { get; set; }
    bool isSecondModalVisible { get; set; }
    async Task ShowConfirmWithTitle()
    {
        bool isConfirmed = await Dialogs.ConfirmAsync("Are you sure?", "Confirmation!");

        Console.WriteLine($"The user is sure: {isConfirmed}.");
    }
}

Attached Files:
7 comments
ADMIN
Joana
Posted on: 02 May 2022 12:28

Hi Kevin,

Thank you for sharing your scenario.

The fixes around modal overlay of the dialog will be included in our next release in 3.3.0. It is scheduled for mid May.

Regards,
Joana
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Kevin
Posted on: 25 Apr 2022 17:14

I was about to submit this issue as well when I found this post.

The main issue I was having is the fact that the dialog window disappears behind the modal window if the user interacts with the modal window while the dialog is still open.

For reference, I created this REPL that demonstrates the issue as well, in case that is helpful:

https://blazorrepl.telerik.com/ccaeGpvB10JOx6HP42

 

ADMIN
Nadezhda Tacheva
Posted on: 05 Apr 2022 12:39

Hi Michal,

The proposed workaround is applicable for TelerikWindow component from which Predefined Dialogs are triggered. At the time of writing the admin edit the TelerikDialog component was not yet available, we only had the Predefined Dialogs.

Testing the TelerikWindow with this workaround seems to work as expected on my end. This is the result I am getting after I click the Delete button of the Grid inside a modal Window in order to open the built-in ConfirmDelete dialog:

Having this in mind, for the time being you can substitute the Dialog with a Window component in order to use this workaround until the issue is fixed.

If you want to keep your current configuration of a Dialog with a Grid inside it, you may add some custom CSS to reduce the z-index of the Dialog component and the k-overlay element. Set their z-index value to 10000, for example, to ensure they will be rendered behind the other dialog. This approach, however, could be tricky - I strongly recommend to use it only if you have one instance of a Dialog component on the page, scope the custom CSS to this page and use a custom class for the Dialog component modifications. Otherwise, things can get mixed up as the z-index of these elements is dynamically changed in some scenarios (e.g. when you have stacked dialogs) and you might end up with some undesired behavior.

The safer approach I would recommend at this stage is to use the Window component as suggested above. I hope you will find the above information useful. Please let us know if other questions are raised.

Regards,
Nadezhda Tacheva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Michal
Posted on: 29 Mar 2022 17:30

Hi,

 workaround(version 3.1.0) not working when using another "modal dialog" inside:
1) - TelerikDialog = Confirm Dialog is BEHIND the TelerikDialog , so not visible at all(trap and user cannot continue)
<TelerikDialog Width="40%" Draggable="true" Modal="true">
<DialogContent>
<TelerikGrid ConfirmDelete="true" ....

2)- TelerikWindow = Confirm dialog is in front, but overlay is BEGHIND TelerikWindow (partly usable for end users)

<TelerikWindow Width="40%" Draggable="true" Modal="true">
<WindowContent>
<TelerikGrid ConfirmDelete="true" ....

Same behaviour is reproducible when using DialogFactory instead builtin ConfirmDelete in grid:
[CascadingParameter]
public DialogFactory Dialogs { get; set; }
await Dialogs.ConfirmAsync(....

Is there any new workaround?
Have a nice day
ADMIN
Nadezhda Tacheva
Posted on: 21 Sep 2021 14:45

Hi Chris,

I tested the provided workaround in a sample application that uses version 2.26.0 of Telerik UI for Blazor. I used the same code snipped as listed below and, as the workaround suggests, I added display:flex to the body in the site.css file.

It looks to me that the workaround is working as expected. See project attached and a video of the result. You can also try running it locally and see how it behaves on your side. Then, you can use it as reference to check whether any differences might be causing the issue in your application.

If you run across any other concerns, please let us know. We will be happy to step in and assist.

Regards,
Nadezhda Tacheva
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Chris
Posted on: 14 Sep 2021 22:02
I'm using 2.26.0
Chris
Posted on: 14 Sep 2021 21:56
I don't think this workaround is valid anymore.