-
Notifications
You must be signed in to change notification settings - Fork 6.7k
multiple modals & z-index issue #5670
Comments
File reference: src/modal/modal.js Seems like it's related to the calculation of z-index (1050 + 10*index). The "backdropScope.index" of each existing modal is not updated when you remove a modal. I think the assumption was that normally you'd only remove the top modal? The function backdropIndex() returns the value that's expected for the topmost modal you're inserting it seems. So in your example, the modals are stuck with the z-index 1090 as long as 5 modals are open when you try to add another one then all succeeding modals are added with z-index 1090. |
Hm, it sounds like the whole idea of the index needs to be rethought - the index is just computed once as The z-index calculation needs to accommodate changing window lengths and modal indices indicating the order they were opened. PRs welcome. |
This is a low priority issue - this looks like it requires a not-insignificant amount of new logic to accommodate this feature properly, so if this is to be fixed, filing a PR is the best route. |
@anakreon, I'm also going to add that an application with multiple modals beyond two is a pretty bad design and UX, IMO. I could easily see having two in the following use case:
@wesleycho unless someone can convince me of another use case where 3+ modals are appropriate, I suggest we close this as won't fix and update the documentation indicating that the use case put forth above (i.e., 3+ modals and closing some in the middle) will not be supported due to poor UX. |
Well, one could presumably come across this bug even with 3 modals. |
Yup, which is why I asked for a use case of using 3 or more modals. |
Bug description:
Let's say multiple modals are opened at the same time - modals [A, B, C, D], opened in this order. If I close the first opened modal A, then open another modal E -> [B, C, D, E]. The newly opened modal E has the same index & z-index as the previous modal D. With the current reversed order of modals in DOM & same z-index, modal E will not be visible (will be covered by modal D).
Link to minimally-working plunker that reproduces the issue:
https://plnkr.co/edit/GNZtzlaxDM0X8STp8fTD
In the plunkr, i set the limit to 5. So the issue is obvious after 5 opened modals...
Version of Angular, UIBS, and Bootstrap
Angular 1.4.9
UIBS 1.1.2
Bootstrap 3.3.6
The text was updated successfully, but these errors were encountered: