aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2009-11-30 00:03:36 +0000
committerKeith Wood <kbwood.au@gmail.com>2009-11-30 00:03:36 +0000
commitf07293942f42b7415e232833d2016741799da856 (patch)
treebca2469819b074115fbeda16d07cd5a0911ed47e
parent378260f132253fa76a3634311a23bf154808d9a7 (diff)
downloadjquery-ui-f07293942f42b7415e232833d2016741799da856.tar.gz
jquery-ui-f07293942f42b7415e232833d2016741799da856.zip
Datepicker - Fixed #4885 - Tab key should not have default behaviour prevented by datepicker
-rw-r--r--ui/jquery.ui.datepicker.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 181af6ab0..757692cd4 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -421,7 +421,7 @@ $.extend(Datepicker.prototype, {
}
if (inst) {
if (this._curInst == inst) {
- this._hideDatepicker(null);
+ this._hideDatepicker();
}
var date = this._getDateDatepicker(target);
extendRemove(inst.settings, settings);
@@ -475,17 +475,18 @@ $.extend(Datepicker.prototype, {
inst._keyEvent = true;
if ($.datepicker._datepickerShowing)
switch (event.keyCode) {
- case 9: $.datepicker._hideDatepicker(null, '');
+ case 9: $.datepicker._hideDatepicker();
+ handled = false;
break; // hide on tab out
case 13: var sel = $('td.' + $.datepicker._dayOverClass +
', td.' + $.datepicker._currentClass, inst.dpDiv);
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
else
- $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
+ $.datepicker._hideDatepicker();
return false; // don't submit the form
break; // select the value on enter
- case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
+ case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
-$.datepicker._get(inst, 'stepBigMonths') :
@@ -575,9 +576,11 @@ $.extend(Datepicker.prototype, {
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
return;
var inst = $.datepicker._getInst(input);
+ if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+ $.datepicker._curInst.dpDiv.stop(true, true);
+ }
var beforeShow = $.datepicker._get(inst, 'beforeShow');
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
- $.datepicker._hideDatepicker(null, '');
$.datepicker._lastInput = input;
$.datepicker._setDateFromField(inst);
if ($.datepicker._inDialog) // hide cursor
@@ -713,17 +716,17 @@ $.extend(Datepicker.prototype, {
},
/* Hide the date picker from view.
- @param input element - the input field attached to the date picker
- @param duration string - the duration over which to close the date picker */
- _hideDatepicker: function(input, duration) {
+ @param input element - the input field attached to the date picker */
+ _hideDatepicker: function(input) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
return;
if (this._datepickerShowing) {
- duration = duration || this._get(inst, 'duration');
var showAnim = this._get(inst, 'showAnim');
+ var duration = this._get(inst, 'duration');
var postProcess = function() {
$.datepicker._tidyDialog(inst);
+ this._curInst = null;
};
if ($.effects && $.effects[showAnim])
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
@@ -747,7 +750,6 @@ $.extend(Datepicker.prototype, {
}
this._inDialog = false;
}
- this._curInst = null;
},
/* Tidy up after a dialog display. */
@@ -764,7 +766,7 @@ $.extend(Datepicker.prototype, {
!$target.hasClass($.datepicker.markerClassName) &&
!$target.hasClass($.datepicker._triggerClass) &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
- $.datepicker._hideDatepicker(null, '');
+ $.datepicker._hideDatepicker();
},
/* Adjust one of the date sub-fields. */
@@ -857,7 +859,7 @@ $.extend(Datepicker.prototype, {
if (inst.inline)
this._updateDatepicker(inst);
else {
- this._hideDatepicker(null, this._get(inst, 'duration'));
+ this._hideDatepicker();
this._lastInput = inst.input[0];
if (typeof(inst.input[0]) != 'object')
inst.input[0].focus(); // restore focus