Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 7a16778

Browse files
qubiackSplaktar
authored andcommitted
fix(datepicker): md-open-on-focus fails when switching tabs with open datepicker
1 parent 2b0df7e commit 7a16778

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/datepicker/js/datepickerDirective.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,8 @@
838838
}, false);
839839

840840
window.addEventListener(this.windowEventName, this.windowEventHandler);
841+
} else if (this.inputFocusedOnWindowBlur) {
842+
this.resetInputFocused();
841843
}
842844
};
843845

@@ -931,6 +933,14 @@
931933
this.inputFocusedOnWindowBlur = document.activeElement === this.inputElement;
932934
};
933935

936+
/**
937+
* Reset the flag inputFocusedOnWindowBlur to default state, to permit user to open calendar
938+
* again when he back to tab with calendar focused.
939+
*/
940+
DatePickerCtrl.prototype.resetInputFocused = function() {
941+
this.inputFocusedOnWindowBlur = false;
942+
};
943+
934944
/**
935945
* Evaluates an attribute expression against the parent scope.
936946
* @param {String} attr Name of the attribute to be evaluated.

0 commit comments

Comments
 (0)