mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Calendar: Make sure keydown original event is available
This commit is contained in:
parent
d1152a39e6
commit
967e58179e
@ -108,16 +108,7 @@ return $.widget( "ui.calendar", {
|
|||||||
this.date.adjust( "M", this.options.numberOfMonths );
|
this.date.adjust( "M", this.options.numberOfMonths );
|
||||||
this._updateView();
|
this._updateView();
|
||||||
},
|
},
|
||||||
"mousedown .ui-calendar-calendar button": function( event ) {
|
"mousedown .ui-calendar-calendar button": "_select",
|
||||||
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();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mouseenter .ui-calendar-header-buttons button": "_hover",
|
"mouseenter .ui-calendar-header-buttons button": "_hover",
|
||||||
"mouseleave .ui-calendar-header-buttons button": "_hover",
|
"mouseleave .ui-calendar-header-buttons button": "_hover",
|
||||||
"mouseenter .ui-calendar-calendar button": "_hover",
|
"mouseenter .ui-calendar-calendar button": "_hover",
|
||||||
@ -133,12 +124,25 @@ return $.widget( "ui.calendar", {
|
|||||||
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
|
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 ) {
|
_handleKeydown: function( event ) {
|
||||||
var pageAltKey = ( event.altKey || event.ctrlKey && event.shiftKey );
|
var pageAltKey = ( event.altKey || event.ctrlKey && event.shiftKey );
|
||||||
|
|
||||||
switch ( event.keyCode ) {
|
switch ( event.keyCode ) {
|
||||||
case $.ui.keyCode.ENTER:
|
case $.ui.keyCode.ENTER:
|
||||||
this.activeDescendant.mousedown();
|
this._select(
|
||||||
|
$.Event( event, { currentTarget: this.activeDescendant[ 0 ] } )
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
case $.ui.keyCode.PAGE_UP:
|
case $.ui.keyCode.PAGE_UP:
|
||||||
this.date.adjust( pageAltKey ? "Y" : "M", -1 );
|
this.date.adjust( pageAltKey ? "Y" : "M", -1 );
|
||||||
|
Loading…
Reference in New Issue
Block a user