Skip to content

Commit d14366a

Browse files
tobiasbrunnerscottgonzalez
authored andcommitted
Datepicker: only set the focus explicitly if it is not already on the target field. Fixed #6694 – datepicker does not fire change event in IE8
jQuery stores the current content of a field whenever it gets the focus. Since the fixed function is also called for KeyUp events the change event is not triggered anymore when the input looses focus. (cherry picked from commit 39cf7d5)
1 parent d6fa44a commit d14366a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ui/jquery.ui.datepicker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,9 @@ $.extend(Datepicker.prototype, {
700700
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
701701
'Class']('ui-datepicker-rtl');
702702
if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
703-
inst.input.is(':visible') && !inst.input.is(':disabled'))
703+
// #6694 - don't focus the input if it's already focused
704+
// this breaks the change event in IE
705+
inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
704706
inst.input.focus();
705707
// deffered render of the years select (to avoid flashes on Firefox)
706708
if( inst.yearshtml ){

0 commit comments

Comments
 (0)