Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfix(modal): fix for conflicts with ngTouch module on mobile devices #3044
Conversation
This comment has been minimized.
This comment has been minimized.
jbielick
commented on 722036c
Dec 14, 2014
|
Why does the modal window need to close when clicked? It isn't the backdrop, it isn't a close button. When it was in the template, I'm not sure it did anything at all. |
This comment has been minimized.
This comment has been minimized.
|
Yes, it does. It's used to dismiss the dialog if you click on the backdrop. The way it's implemented might be a bit misleading though. The fact that there's a modalBackdrop directive also led me to confussion at first, as I thought that the modalWindow directive was just the dialog without a backdrop. If you take a look at the template https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html , there's a parent div with a class "modal" that actually fills the whole screen, with a z-index higher than the visual backdrop, so it will capture all click events when you hit the backdrop. There's also a child div with a class "modal-dialog" that will contain the actual dialog. So, if you click outside the modal-dialog, a click event will be raised by the parent div. The close function checks if the event was fired from this element and not from any of its children. If this condition is met, the dialog is dismissed. https://github.com/angular-ui/bootstrap/blob/master/src/modal/modal.js#L113 |
This comment has been minimized.
This comment has been minimized.
jbielick
commented on 722036c
Dec 14, 2014
|
Why does the modal window need to close when clicked? It isn't the backdrop, it isn't a close button. When it was in the template, I'm not sure it did anything at all. |
This comment has been minimized.
This comment has been minimized.
|
Yes, it does. It's used to dismiss the dialog if you click on the backdrop. The way it's implemented might be a bit misleading though. The fact that there's a modalBackdrop directive also led me to confussion at first, as I thought that the modalWindow directive was just the dialog without a backdrop. If you take a look at the template https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html , there's a parent div with a class "modal" that actually fills the whole screen, with a z-index higher than the visual backdrop, so it will capture all click events when you hit the backdrop. There's also a child div with a class "modal-dialog" that will contain the actual dialog. So, if you click outside the modal-dialog, a click event will be raised by the parent div. The close function checks if the event was fired from this element and not from any of its children. If this condition is met, the dialog is dismissed. https://github.com/angular-ui/bootstrap/blob/master/src/modal/modal.js#L113 |
aktary
commented
Jan 6, 2015
|
Thank you for this solution! This solved my problem. When is it going to be merged?? |
fix(modal): fix for conflicts with ngTouch module on mobile devices
tomasreichmann
commented
Jan 8, 2015
|
Hi guys, sorry, for such a noob question: Thanks |
|
Not that I'm aware of sorry (I'm new here myself) |
|
@chrisirhc - This was the other PR I merged without cherry picking - shall I revert and add a REady to Merge label? |
adamreisnz
commented
May 11, 2015
|
Has this change been reverted again? When I download the latest version (0.13.0), looking in the template code for modals, I find This is still causing issues when ngTouch is enabled. |
dubejf
commented
May 15, 2015
|
Yes, the merge was reverted by @chrisirhc. Why? |
|
Sorry, I reverted it initially because it didn't follow our merging guidelines. And I believe we forgot about re-applying the change since then. Reopening #2280 to avoid confusion. |
philefstat
commented
Jul 2, 2015
|
Looking forward to this fix being re-merged at some point... |
piotrd
commented
Jul 2, 2015
|
twhamilton
commented
Jul 23, 2015
|
+1 Please ! |
khoacoi
commented
Jul 27, 2015
|
khoacoi
commented
Aug 20, 2015
|
Hi, Is there any update when this change can be merged? Is there any work around solution to fix this issue? Thanks, |
twhamilton
commented
Aug 20, 2015
|
The fix is in one of the links above. This is what I did.. in ui-boostrap-tpls.js /* THIS WAS THE ORIGINAL Then in ui-boostrap.js added the element.on function .directive('modalWindow', [
|
mastef
commented
Sep 7, 2015
|
@chrisirhc Anything specific that was wrong in the PR? Would love to resubmit PR to have this implemented. Could you point at the right direction what was wrong with the PR? |
|
@mastef, I don't think there'll be any issues, but given the age of this, please rebase and ensure your code is fully up-to-date and that this PR would still have no conflicts. additionally, we've since implemented a CI build that will get kicked off when you submit a PR that was clearly instituted after you submitted this originally. I don't know that we'll require it given the nature of this change, but it might be nice just for sanity sake. @wesleycho, would you have any hesitations merging this as is or if you had other stipulations, what would they be? |
|
I don't think there were any issues (besides lack of tests, but I'm not sure how to test, and that shouldn't block it), it just needs to be re-cherry-picked into the code. |
|
I'm still a bit baffled why this fixes the issue, but I fon't have any particular objections if it works |
|
I believe it's because ngTouch adds an ngClick directive that attempts to be smart about detecting where you're tapping. However, in this case, it incorrectly detects tapping on the modal while it should instead tap into elements within the modal. |
- Merge pull request angular-ui#3044 from jiniguez/fix2280 Conflicts: src/modal/modal.js template/modal/window.html Fixes angular-ui#2280
- Merge pull request angular-ui#3044 from jiniguez/fix2280 Conflicts: src/modal/modal.js template/modal/window.html Fixes angular-ui#2280
- Merge pull request angular-ui#3044 from jiniguez/fix2280 Conflicts: src/modal/modal.js template/modal/window.html Fixes angular-ui#2280 Closes angular-ui#4357
jiniguez commentedDec 3, 2014
This change attempts to fix issue #2280
ng-click directive has been removed from modal template and click event moved to the modal-window directive code, so the click event keeps firing and modal window closes when clicking on the backdrop. Not sure if there's a better place to put this event but the fix seems to be working.