Skip to content
Permalink
Browse files

Datepicker - Fixed #4885 - Tab key should not have default behaviour …

…prevented by datepicker
  • Loading branch information
Keith Wood
Keith Wood committed Nov 30, 2009
1 parent 378260f commit f07293942f42b7415e232833d2016741799da856
Showing with 14 additions and 12 deletions.
  1. +14 −12 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

0 comments on commit f072939

Please sign in to comment.
You can’t perform that action at this time.