-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Datepicker is-open weirdness #3705
Comments
@RobJacobs Mr. Datepicker, any thoughts on this? |
The date picker popup binds a document click event here. I believe if we wrap that in a $timeout the originating click event would not get captured. I'll test that theory later today or tomorrow. |
Cool @RobJacobs thanks for looking into it. Although I must say that my Angular-alert-system went off on the keywords 'wrap that in a $timeout'. Are you sure that's the way to go on this? |
Using $timeout(function() { ... }, 0, false) prevents angular from triggering another digest cycle while waiting for the current cycle to complete. So there should not be a performance hit, but I could be wrong. |
I would say go for it -- it's better to have a fix and refactor later if someone else has a better plan instead of not applying a fix at all. |
Well this is encouraging! Assuming the fix is made I'm guessing it would be non-breaking? i.e. People out there using |
Under PR #3666 I moved the $timeout call for setting focus to the datepicker popup to this line: Moving the document click bind to the $timeout like so:
Does negate the need for calling stopPropagation and preventDefault in the trigger element click event. I want to wait until #3666 is merged to master before creating another PR so I don't have to worry about merge conflicts. |
Great - thanks for the update! |
Thank you for this, but it seems that the solution, at least for me was the both |
Hi,
I've noticed that when setting
is-open
totrue
using anng-click
on the text element itself the date picker popup opens and closes as you would expect. However, if you move theng-click
to a separate button (the calendar glyph for instance) that this does not work.This plunk demonstrates the problem.
The solution is the pass
$event
and then call$event.stopPropagation()
. This is a behaviour is little unexpected and prompts these questions:The text was updated successfully, but these errors were encountered: