angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.27k stars 6.73k forks source link

fix(modal): backdrops for appendTo (modal in modal) #6303

Open malaupa opened 8 years ago

malaupa commented 8 years ago

Modals couldn't be used in modals (open a modal in a modal) and other containers. A new backdrop is now created on each appendTo element which is used in the app. If a backdrop exist on a element it is reused and the backdrop index is increase (old behavoir). To recognize which element has already a backdrop appended, a data-backtrop attribute is written on the related element.

Closes #6219 and #2678 is also related

wesleycho commented 8 years ago

This needs to be configurable, as this would otherwise be a significant breaking change.

wesleycho commented 8 years ago

This also needs unit tests

malaupa commented 8 years ago

Could we use backdropAppend as the a new param for backdrop creation on each appendTo element? Do you prefer another parameter name? Values could be true or false?

I will create unit tests and commit them in combination with the changes related to the configuration param after your response.

wesleycho commented 7 years ago

We could, but that should perhaps be a separate PR - multiple backdrops as siblings should be ok, as long as they are created in order. Appending the backdrop to the appropriate location then can follow as separate work.

malaupa commented 7 years ago

Could you please tell me in detail, which work should be separated in different PRs?

At the moment it is only the following behaviour, which will be changed:

  1. configuration option to append backdrops to the appropriate location (the appendTo element), if appendTo is configured

And this is the idea of this PR. If you agree with me, could this PR be merged, if I add tests and the configuration option?

wesleycho commented 7 years ago

That would be sufficient if those changes are made plus documentation.

paneyi commented 7 years ago

@malaupa, what's the status of this? I got to this answer while looking for a way to keep multiple modals opened on different "tabs" (achieved using ui-router-sticky-states and ui-router-future-states), each one with its own backdrop. Right now, each modal is contained in the proper tab, but the backdrop remains below the first created modal, leaving the modals on the other tabs without a backdrop.

malaupa commented 7 years ago

@paneyi, currently I have no time to add tests and the configuration option, but this PR is still on my todo list and will be fixed.

For clarification: the idea of this PR is to create a modal inside a already opened modal with suitable backdrop limited to outer modal.