|
530 | 530 |
|
531 | 531 | // Add event listener through angular so that we can triggerHandler in unit tests.
|
532 | 532 | self.ngInputElement.on('keydown', function(event) {
|
533 |
| - if (event.altKey && event.keyCode == keyCodes.DOWN_ARROW) { |
| 533 | + if (event.altKey && event.keyCode === keyCodes.DOWN_ARROW) { |
534 | 534 | self.openCalendarPane(event);
|
535 | 535 | $scope.$digest();
|
536 | 536 | }
|
537 | 537 | });
|
538 | 538 |
|
539 | 539 | if (self.openOnFocus) {
|
540 | 540 | self.ngInputElement.on('focus', angular.bind(self, self.openCalendarPane));
|
| 541 | + self.ngInputElement.on('click', function(event) { |
| 542 | + event.stopPropagation(); |
| 543 | + }); |
| 544 | + self.ngInputElement.on('pointerdown',function(event) { |
| 545 | + if (event.target && event.target.setPointerCapture) { |
| 546 | + event.target.setPointerCapture(event.pointerId); |
| 547 | + } |
| 548 | + }); |
| 549 | + |
541 | 550 | angular.element(self.$window).on('blur', self.windowBlurHandler);
|
542 | 551 |
|
543 | 552 | $scope.$on('$destroy', function() {
|
|
551 | 560 | };
|
552 | 561 |
|
553 | 562 | /**
|
554 |
| - * Capture properties set to the date-picker and imperitively handle internal changes. |
| 563 | + * Capture properties set to the date-picker and imperatively handle internal changes. |
555 | 564 | * This is done to avoid setting up additional $watches.
|
556 | 565 | */
|
557 | 566 | DatePickerCtrl.prototype.installPropertyInterceptors = function() {
|
|
822 | 831 | // Attach click listener inside of a timeout because, if this open call was triggered by a
|
823 | 832 | // click, we don't want it to be immediately propagated up to the body and handled.
|
824 | 833 | var self = this;
|
825 |
| - this.$timeout(function() { |
| 834 | + this.$mdUtil.nextTick(function() { |
826 | 835 | // Use 'touchstart` in addition to click in order to work on iOS Safari, where click
|
827 | 836 | // events aren't propagated under most circumstances.
|
828 | 837 | // See http://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
829 | 838 | self.documentElement.on('click touchstart', self.bodyClickHandler);
|
830 |
| - }, 100); |
| 839 | + }, false); |
831 | 840 |
|
832 | 841 | window.addEventListener(this.windowEventName, this.windowEventHandler);
|
833 | 842 | }
|
|
0 commit comments