I noticed a strange behavior with Mantine’s ModalStack component that occurs when using the close button or clicking outside the modal to close. Instead of just closing the modal, it seems traverse the modal stack in reverse.
For example, say I have 2 modals in the stack:
dmc.ModalStack(
[
dmc.ManagedModal(id='load_modal', children=[...]),
dmc.ManagedModal(id='confirmation', children=[...])
]
)
The expected sequence is the user opens the load_modal, makes a selection, clicks a load button, then confirmation is displayed. This works as expected. Now however, if you click outside the modal or use the close button (x in the upper right) in the confirmation modal, it will take you back to load_modal rather than closing. You can circumvent this by disabling the close button and setting closeOnClickOutside = False, but it seems to me as not an ideal solution as you will need to manually implement a close button. Preferably, clicking outside or using the close button should have an option for simply closing all modals.
Is this expected behavior? Are there any workarounds besides disabling the closing features so that all modals get closed when using the close button or clicking outside?