Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Datepicker inside a modal window causes modal to close #55

Closed
gromon42 opened this issue Aug 1, 2016 · 4 comments
Closed

Datepicker inside a modal window causes modal to close #55

gromon42 opened this issue Aug 1, 2016 · 4 comments

Comments

@gromon42
Copy link

gromon42 commented Aug 1, 2016

Hey,

I have an issue in my app, i have 2 inputs in which i'm getting the values of your datepickers but when i pick a date too quickly and then try to click on the other input field then it causes my current modal to close itself.

I've checked online for a quick fix but nothing seems to match my current problem. Maybe adding some setTimeOut on the Ok button validation will fix the problem but that is not the best way to handle things in my opinion.

Looking forward to hear if you got the same problem at some point

@katemihalikova
Copy link
Owner

Hi Gaultier,
could you please make up a codepen/plnkr/jsbin demonstrating your problem? Thanks!

@neolectron
Copy link

Here's the problem.
I know its not only about your dateTimePicker but its the same bug.
So it directly affect your work.
http://codepen.io/anon/pen/KrxRXx

--- instruction :
open a modal -> open an alert/popup -> close and QUICKLY click anywhere on the modal.
It will cause the modal to close itself too.

@gromon42
Copy link
Author

gromon42 commented Aug 3, 2016

Yes that is exactly the bug that i'm having actually ! I ve also just seen your latest issue posted on the ionic framework and it doesnt seem to have a fix for it just yet. But yeah it would be nice if we could find a solution all together because this is happening with all popups/alert/confirm.

@katemihalikova
Copy link
Owner

Thanks!

The bug lays in ionic. AFAIK their backdrops are separate entities and clicking on a backdrop closes the topmost entity. When the popup is being hidden, the backdrop already knows that the topmost entity is now the modal, but the backdrop is still clickable until its animation ends. When the backdrop is clicked in such situation, the modal is closed, because backdrop service doesn't know that the backdrop is being hidden and shouldn't be clickable.

You can watch and 👍 ionic-team/ionic-framework#5869 issue that should solve that. Workaround for now is to set backdropClickToClose: false in modal options object.

I'm going to close this issue as the problem lays in framework code and workaround exists.

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

3 participants