Completed
Last Updated: 16 Mar 2021 08:39 by ADMIN
Release 2.23.0
Gert
Created on: 06 May 2019 12:45
Category: Window
Type: Feature Request
37
Support for multiple (nested) modal windows

At the moment, a second modal window does not "block" the first.

For example, a static variable in aTelerik Window class can be used to track the z-index and render the dialog and modal background with increasing values when a new one is shown.

If you have other suggestions on handling the situation, share them below. Also, comment whether you would like that static class/variable to be public so you can set its initial value.

10 comments
ADMIN
Marin Bratanov
Posted on: 12 Mar 2021 18:33

Hello Marc,

You are right on all counts - the cause and that we are handling all windows.

Regards,
Marin Bratanov
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.

Marc Simkin
Posted on: 12 Mar 2021 18:31

I have seen this issue whether the TelerikWindow is modal or non-modal.  I suspect it is related to z-index being the same on both windows.

If the modal window is defined earlier in the dom  than the non-modal window, it will not come to the top when mad visible.

Hopefully, when this feature is implemented it will fix the generic window on window issue.

ADMIN
Marin Bratanov
Posted on: 11 Jul 2020 16:26

Thank you for your feedback, Doug. At this point I expected that the windows would track and increment the z-index on their own, but maybe adding an explicit option may be useful too.

 

Regards,
Marin Bratanov
Progress Telerik

Doug
Posted on: 11 Jul 2020 14:00
Thanks Marin. I should have checked dev tools before because even though the second window is further down in my razor file it can be rendered above the first depending on the situation. It would be great to be able to explicitly set the z-index.
ADMIN
Marin Bratanov
Posted on: 11 Jul 2020 07:03

Hello Doug,

At the moment, all windows have the same z-index which starts off from their topmost element in the DOM. Thus, the order of those elements in the DOM determines which window will be at the top - the last one. You can inspect that in the browser dev tools when you have two instances open to see how it looks.

 

Regards,
Marin Bratanov
Progress Telerik

Doug
Posted on: 11 Jul 2020 02:57

Marin,

Maybe you can shed some light on this, and for others who may be interested, I have in fact been able to get it to work where one TelerikWindow shows up on top of another TelerikWindow without hiding the first. I haven't been able to figure out the rhyme or reason to it but it matters where in the DOM the windows are in relation to each other (and potentially other elements). With the windows in certain positions relative to each other the second window will show on top of the first, but if I move the second window a few lines down in the DOM then it shows up behind. So as long as I get the windows positioned "correctly" in the DOM life is good but I'm curious as to what's happening here.

ADMIN
Marin Bratanov
Posted on: 19 May 2020 13:12

A quick update - the previous snippet could work if the second modal is after the first in the DOM. If they are not, you could do a small bit of logic in the Visible parameter of the first:

<TelerikWindow @bind-Visible="@secondVisible" Modal="true">
    <WindowContent>the second dialog</WindowContent>
    <WindowActions>
        <WindowAction Name="Close"></WindowAction>
    </WindowActions>
    <WindowTitle>SECOND</WindowTitle>
</TelerikWindow>

<TelerikWindow Visible="@IsFirstVisible()" VisibleChanged="@( (bool v) => firstVisible = v )" Modal="true">
    <WindowContent>
        first window content.
        <TelerikButton OnClick="@( _ => secondVisible = true)">Show the second</TelerikButton>
    </WindowContent>
    <WindowActions>
        <WindowAction Name="Close"></WindowAction>
    </WindowActions>
    <WindowTitle>FIRST</WindowTitle>
</TelerikWindow>


<TelerikButton OnClick="@( _ => firstVisible = true)">Show the first dialog</TelerikButton>

@code{
    bool firstVisible { get; set; }
    bool secondVisible { get; set; }
    bool IsFirstVisible()
    {
        return firstVisible && !secondVisible;
    }
}

For cases where you can't control the first dialog (say, the grid's popup editing) there are two options:

  • wait for this feature to get implemented
  • OR, use a custom popup form where you can apply either of these approaches

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
ADMIN
Marin Bratanov
Posted on: 28 Apr 2020 15:47

If you have control over both modals, you can use CSS to hide the first one to only show the second, something like this:

<style>
    .visuallyHidden{
        display:none;   
    }
</style>

<TelerikWindow @bind-Visible="@firstVisible" Modal="true" Class="@( secondVisible ? "visuallyHidden" : "" )">
    <WindowContent>
        first window content.
        <TelerikButton OnClick="@( _ => secondVisible = true)">Show the second</TelerikButton>
    </WindowContent>
    <WindowActions>
        <WindowAction Name="Close"></WindowAction>
    </WindowActions>
    <WindowTitle>FIRST</WindowTitle>
</TelerikWindow>

<TelerikWindow @bind-Visible="@secondVisible" Modal="true">
    <WindowContent>the second dialog</WindowContent>
    <WindowActions>
        <WindowAction Name="Close"></WindowAction>
    </WindowActions>
    <WindowTitle>SECOND</WindowTitle>
</TelerikWindow>

<TelerikButton OnClick="@( _ => firstVisible = true)">Show the first dialog</TelerikButton>

@code{
    bool firstVisible { get; set; }
    bool secondVisible { get; set; }
}

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
ADMIN
Marin Bratanov
Posted on: 07 Oct 2019 07:07

For anyone looking for alert/confirm/prompt type dialogs, I suggest you Follow and Vote on Patrick's other request here: https://feedback.telerik.com/blazor/1433023-predefined-windows. In the meantime, you can achieve them by implementing your own components holding TelerikWindow instances that have some predefined settings/content as per your needs; then those components can expose methods that toggle the dialog, and parameters for size, content, title, etc.

In the web we don't have the luxury of having parents for windows and popups, so we can't have a modal window block only certain other windows. The idea of the initial request is that you should be able to open more than one modal dialog and the last one will be on top so the user can interact only with it. Something like this may be needed when we re-implement dragging as well - the currently focused window should be at the top of the stack. This means that all windows will need the ability to track their stacking order and communicate it to each other.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Datafyer
Posted on: 06 Oct 2019 01:03

Maybe I am thinking more like a desktop application.

However I have a window which is used for the user to select things for the main visible window.
If there are issues then an alert is shown which should be on top of the selection window, which itself is on top of the main window.

Data annotations is another way to show similar things however I personally prefer alert dialogs instead of passive messages.