mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Datepicker: Updated Mac keyboard commands
This commit is contained in:
parent
c9a8ee531c
commit
502916f65f
@ -474,7 +474,8 @@ $.extend(Datepicker.prototype, {
|
||||
switch (e.keyCode) {
|
||||
case 9: $.datepicker._hideDatepicker(null, '');
|
||||
break; // hide on tab out
|
||||
case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
|
||||
case 13: if ($('td.ui-datepicker-days-cell-over', inst.dpDiv)[0])
|
||||
$.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
|
||||
$('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
|
||||
return false; // don't submit the form
|
||||
break; // select the value on enter
|
||||
@ -488,24 +489,34 @@ $.extend(Datepicker.prototype, {
|
||||
+$.datepicker._get(inst, 'stepBigMonths') :
|
||||
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
||||
break; // next month/year on page down/+ ctrl
|
||||
case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
|
||||
case 35: if (e.ctrlKey || e.metaKey) $.datepicker._clearDate(e.target);
|
||||
handled = e.ctrlKey;
|
||||
break; // clear on ctrl+end
|
||||
case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
|
||||
break; // clear on ctrl or command +end
|
||||
case 36: if (e.ctrlKey || e.metaKey) $.datepicker._gotoToday(e.target);
|
||||
handled = e.ctrlKey;
|
||||
break; // current on ctrl+home
|
||||
case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
|
||||
break; // current on ctrl or command +home
|
||||
case 37: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -1, 'D');
|
||||
handled = e.ctrlKey;
|
||||
break; // -1 day on ctrl+left
|
||||
case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
|
||||
// -1 day on ctrl or command +left
|
||||
if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ?
|
||||
-$.datepicker._get(inst, 'stepBigMonths') :
|
||||
-$.datepicker._get(inst, 'stepMonths')), 'M');
|
||||
// next month/year on alt +left on Mac
|
||||
break;
|
||||
case 38: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -7, 'D');
|
||||
handled = e.ctrlKey;
|
||||
break; // -1 week on ctrl+up
|
||||
case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
|
||||
break; // -1 week on ctrl or command +up
|
||||
case 39: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +1, 'D');
|
||||
handled = e.ctrlKey;
|
||||
break; // +1 day on ctrl+right
|
||||
case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
|
||||
// +1 day on ctrl or command +right
|
||||
if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ?
|
||||
+$.datepicker._get(inst, 'stepBigMonths') :
|
||||
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
||||
// next month/year on alt +right
|
||||
break;
|
||||
case 40: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +7, 'D');
|
||||
handled = e.ctrlKey;
|
||||
break; // +1 week on ctrl+down
|
||||
break; // +1 week on ctrl or command +down
|
||||
default: handled = false;
|
||||
}
|
||||
else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home
|
||||
|
Loading…
Reference in New Issue
Block a user