Skip to content

Commit 85b8816

Browse files
committed
Datepicker: use a setTimeout 0 so the same code can run in IE (as other browsers) to set focus back to the datepicker text input if a month or year drop-down is clicked closed. Fixes #5897 - Datepicker: inconsistent behavior in IE when click to close month and year drop-downs
1 parent 26b2d2d commit 85b8816

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ui/jquery.ui.datepicker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,11 @@ $.extend(Datepicker.prototype, {
846846
_clickMonthYear: function(id) {
847847
var target = $(id);
848848
var inst = this._getInst(target[0]);
849-
if (inst.input && inst._selectingMonthYear && !$.browser.msie)
850-
inst.input.focus();
849+
if (inst.input && inst._selectingMonthYear) {
850+
setTimeout(function() {
851+
inst.input.focus();
852+
}, 0);
853+
}
851854
inst._selectingMonthYear = !inst._selectingMonthYear;
852855
},
853856

0 commit comments

Comments
 (0)