Modal order in parent layout containers -- does anybody know the rules?

When I create a panel.Modal object and place it in a container in my app to be rendered sometimes it will only appear if I put it as the first object in a Column (or Row) and in another situations I have to put it as the last item in the list.

I assume this is some kind of z-order calculation, but does anybody know what the rules are for the calculation? I have two apps and in one it has to go first and the other last, no idea why!

Thanks for any help!

Actually on further experimenting this seems to possibly be a problem with autoreload? The first time the app goes live the modal can’t be interacted with, but after saving a file and refreshing the page then the modal can be used.

Do you have some code?

I think to use modals, you need to add it into a Column/Row that is servable.