aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2016-05-22 17:19:09 +0200
committerFelix Nagel <info@felixnagel.com>2016-10-05 18:32:10 +0200
commit967e58179eba0d2bd19c952abb4219be7e43f1ea (patch)
treefd72aecc0e5a6abaac37a54a14ed58ba4c6c3600
parentd1152a39e635a0a72fb6c13c82425bc9ff4e569f (diff)
downloadjquery-ui-967e58179eba0d2bd19c952abb4219be7e43f1ea.tar.gz
jquery-ui-967e58179eba0d2bd19c952abb4219be7e43f1ea.zip
Calendar: Make sure keydown original event is available
-rw-r--r--ui/widgets/calendar.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/ui/widgets/calendar.js b/ui/widgets/calendar.js
index 4c9a03545..805547f75 100644
--- a/ui/widgets/calendar.js
+++ b/ui/widgets/calendar.js
@@ -108,16 +108,7 @@ return $.widget( "ui.calendar", {
this.date.adjust( "M", this.options.numberOfMonths );
this._updateView();
},
- "mousedown .ui-calendar-calendar button": function( event ) {
- this._setOption( "value", new Date( $( event.currentTarget ).data( "timestamp" ) ) );
- this._updateDayElement( "ui-state-active" );
-
- // Allow datepicker to handle focus
- if ( this._trigger( "select", event ) !== false ) {
- this.activeDescendant.closest( this.grid ).focus();
- event.preventDefault();
- }
- },
+ "mousedown .ui-calendar-calendar button": "_select",
"mouseenter .ui-calendar-header-buttons button": "_hover",
"mouseleave .ui-calendar-header-buttons button": "_hover",
"mouseenter .ui-calendar-calendar button": "_hover",
@@ -133,12 +124,25 @@ return $.widget( "ui.calendar", {
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
},
+ _select: function( event ) {
+ this._setOption( "value", new Date( $( event.currentTarget ).data( "timestamp" ) ) );
+ this._updateDayElement( "ui-state-active" );
+
+ // Allow datepicker to handle focus
+ if ( this._trigger( "select", event ) !== false ) {
+ this.activeDescendant.closest( this.grid ).focus();
+ event.preventDefault();
+ }
+ },
+
_handleKeydown: function( event ) {
var pageAltKey = ( event.altKey || event.ctrlKey && event.shiftKey );
switch ( event.keyCode ) {
case $.ui.keyCode.ENTER:
- this.activeDescendant.mousedown();
+ this._select(
+ $.Event( event, { currentTarget: this.activeDescendant[ 0 ] } )
+ );
return;
case $.ui.keyCode.PAGE_UP:
this.date.adjust( pageAltKey ? "Y" : "M", -1 );