Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Multiple modal messed up backdrop #13

Closed
maxisam opened this issue Nov 2, 2012 · 4 comments
Closed

Multiple modal messed up backdrop #13

maxisam opened this issue Nov 2, 2012 · 4 comments

Comments

@maxisam
Copy link

maxisam commented Nov 2, 2012

I ran into an issue if you have multiple modal, the backdrop somehow will be messed up.

Since the var backdropEl;is shared across the directives, only one backdrop element will be inserted to body.

Therefore if you open a second modal before closing the first one and close it, the screen will have no backdrop when the first modal remains open.

I think there are two ways to fix this.

  1. Movevar backdrop into link function, so every modal has its own backdrop.
  2. Having a counter across the directives for keeping track how many modal is opened.

And elm.parent().append(backdropEl); instead of body.append(backdropEl);
in case the modal is inside of a template, when you load template, the a new backdrop will be appended to body.

@pkozlowski-opensource
Copy link
Member

Thnx for catching this! If you feel like sending a pull request this would be of tremendous help!

@maxisam
Copy link
Author

maxisam commented Nov 2, 2012

I just did. It is my first time to do this kinda stuff. I hope I didn't do it wrong.

@pkozlowski-opensource
Copy link
Member

I don't know, we should be probably stacking up modals if multiple of them are open. But while doing so we should refactor both the modal directive and the $dialog service to have the logic dealing with backdrops in one place.

@pkozlowski-opensource
Copy link
Member

Fix for this landed in ec796ec

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants