@@ -108,16 +108,7 @@ return $.widget( "ui.calendar", {
108
108
this . date . adjust ( "M" , this . options . numberOfMonths ) ;
109
109
this . _updateView ( ) ;
110
110
} ,
111
- "mousedown .ui-calendar-calendar button" : function ( event ) {
112
- this . _setOption ( "value" , new Date ( $ ( event . currentTarget ) . data ( "timestamp" ) ) ) ;
113
- this . _updateDayElement ( "ui-state-active" ) ;
114
-
115
- // Allow datepicker to handle focus
116
- if ( this . _trigger ( "select" , event ) !== false ) {
117
- this . activeDescendant . closest ( this . grid ) . focus ( ) ;
118
- event . preventDefault ( ) ;
119
- }
120
- } ,
111
+ "mousedown .ui-calendar-calendar button" : "_select" ,
121
112
"mouseenter .ui-calendar-header-buttons button" : "_hover" ,
122
113
"mouseleave .ui-calendar-header-buttons button" : "_hover" ,
123
114
"mouseenter .ui-calendar-calendar button" : "_hover" ,
@@ -133,12 +124,25 @@ return $.widget( "ui.calendar", {
133
124
this . _addClass ( $ ( event . currentTarget ) , null , "ui-state-hover" ) ;
134
125
} ,
135
126
127
+ _select : function ( event ) {
128
+ this . _setOption ( "value" , new Date ( $ ( event . currentTarget ) . data ( "timestamp" ) ) ) ;
129
+ this . _updateDayElement ( "ui-state-active" ) ;
130
+
131
+ // Allow datepicker to handle focus
132
+ if ( this . _trigger ( "select" , event ) !== false ) {
133
+ this . activeDescendant . closest ( this . grid ) . focus ( ) ;
134
+ event . preventDefault ( ) ;
135
+ }
136
+ } ,
137
+
136
138
_handleKeydown : function ( event ) {
137
139
var pageAltKey = ( event . altKey || event . ctrlKey && event . shiftKey ) ;
138
140
139
141
switch ( event . keyCode ) {
140
142
case $ . ui . keyCode . ENTER :
141
- this . activeDescendant . mousedown ( ) ;
143
+ this . _select (
144
+ $ . Event ( event , { currentTarget : this . activeDescendant [ 0 ] } )
145
+ ) ;
142
146
return ;
143
147
case $ . ui . keyCode . PAGE_UP :
144
148
this . date . adjust ( pageAltKey ? "Y" : "M" , - 1 ) ;
0 commit comments