Modal on Modal

Is it possible to have a web modal window pop up on top of another web model window? At the moment when I call one, it gets placed behind the first modal.

Interesting that using the same dialog works as expected:
samedialog.2022-05-20 07_51_53

Without looking, if they have the same z-index, then I think DOM order controls their z position.

2 Likes

using z-index forcing, I am able to stack 4 different modal dialogs on top of each other.

Yeah, I use a bit of JS that traverses the DOM and calculates the highest z-index and applies that value plus one to ensure that nodes which should be at the top of the stack are always at the top.

for my websdk alerts, I have such JS method to ensure the alert is on top of the others too.

You are correct:

It looks like Xojo (for Jean-Yves Feedback case and I guess James too), the second WebDialog div is before the first WebDialog, like this:
image
so the second Dialog shows behind the first.

When we use the same dialog, then each newly created dialog will be after the previous one, that’s why they show correctly.

Maybe @Ricardo_Cruz can think of a way to reorder the dialogs or some other way to allow us to send several WebDialogs without using the JS workaround (modify z-index)

or add an optionnal z-index parameter to the showmodal method.

1 Like

I had time to revisit this, I can’t find a way to control how Xojo orders the WebDialog Instances, but if you don’t use Instances and create a new WebDialog like:

var dlg as new WebDialog2
dlg.show

you can get this:
ezgif.com-gif-maker (1)

Jean-Yves, I updated your feedback case 66151 with a modification. Just did fast testing don’t know if this will work on all situations.

2 Likes