-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request ability to stack Modals #2614
Request ability to stack Modals #2614
Comments
IMO the backdrop must not be added again if it was previously added, just if the backdrop property of the second modal is equal "false". Meanwhile I guess popups opened with the default behaviour (backdrop=static or backdrop=true) should have the implementation described by @elebetsamer and the z-index ordering. In my scenario, there are some modals that could have an extra modal to confirm the exclusion of the item being edited, I put a special class called 'modal-confirmation' on the modal element and the link that trigger the modal has a "backdrop=false" attribute. This resolved my problem but, if I need another modal on the flow, I'll came across the same issue. |
Since I didn't get much of a response, I just went ahead and made the changes and submitted a pull request. #2644 |
I'd like to request the ability to stack modals. Right now there are two main things that making Modal stacking difficult:
First Modal, everything is fine: http://twitpic.com/show/full/8wdshj.png
Second Modal, we get a double backdrop and can barely see the site below it. The first modal is still clickable. http://twitpic.com/show/full/8wdszp.png
Third Modal, we now have a triple backdrop and the site can't be seen at all. The first and second modals are still clickable. http://twitpic.com/show/full/8wdt3s.png
I've managed to fix problem 1 as described above in my own code. In bootstrap-modal.js I've changed code in:
function backdrop
. My fix still adds the backdrop, but applies a class to it to make it transparent. This way it is still clickable, but just doesn't muck up the visuals.Original Code
Updated Code
I've also added the css below to the modals.less file:
I haven't had time to try to fix the stacking issue though. I have given it some thought, but not tried anything out yet. I was thinking that every time a Modal is opened, we could keep track of the open Modal count using the body tag and a data attribute. And when a Modal is opened, we could check the value of that data attribute and then do a "sendToBack" (probably just add a css class with a lower z-index than the modal backdrop) on any previously opened Modals. Then when a Modal is closed, we could again check the values and do a "sendToFront" for any modals that were a level lower than the Modal we are closing.
I don't know if I'm the only person that has run into stacking issues with Modals, but I think this would be a great addition to the framework. Please let me know if you have any questions or what you think about the way I've implemented a fix for the backgdrop stacking, or my idea of how to fix the Modal stacking. I haven't had much time to try to fix the Modal stacking, but if my idea get's the blessing here, I'll find some time to work on it and try to get it in for the next release.
Thanks.
The text was updated successfully, but these errors were encountered: