mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Calendar: Fix view when moving between multiple months with keyboard
Make sure numberOfMonths is taken into account while navigating with keyboard when rendering multiple calendar grids (numberOfMonths > 1).
This commit is contained in:
parent
38101a478b
commit
09be7b328e
@ -257,9 +257,17 @@ test( "numberOfMonths", function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Test for jumping in weekday rendering after click on last day of last grid
|
// Test for jumping in weekday rendering after click on last day of last grid
|
||||||
equal( container.find( "thead:last th:last" ).text(), "Sa", "Before click: Last day is saturday" );
|
|
||||||
container.find( "tbody:last td[id]:last button" ).trigger( "mousedown" );
|
container.find( "tbody:last td[id]:last button" ).trigger( "mousedown" );
|
||||||
equal( container.find( "thead:last th:last" ).text(), "Sa", "After click: Last day is saturday" );
|
equal( container.find( "thead:last th:last" ).text(), "Sa",
|
||||||
|
"After mousedown last month: Last day is Saturday"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Test if using cursor down to go to the next month advances three month
|
||||||
|
container.find( "tbody:first td[id]:first button" ).trigger( "mousedown" );
|
||||||
|
$( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
|
equal( container.find( ".ui-calendar-month:first" ).text(), "May",
|
||||||
|
"After move to previous month: First month is May"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -150,7 +150,14 @@ return $.widget( "ui.calendar", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this._needsRefresh() ) {
|
if ( this._needsRefresh() ) {
|
||||||
this._refresh();
|
if ( this.options.numberOfMonths > 1 && this.date.year() === this.viewDate.year() ) {
|
||||||
|
this.viewDate.adjust( "M", this.options.numberOfMonths *
|
||||||
|
( this.date.month() > this.viewDate.month() ? 1 : -1 )
|
||||||
|
);
|
||||||
|
this.refresh();
|
||||||
|
} else {
|
||||||
|
this._refresh();
|
||||||
|
}
|
||||||
this.grid.focus();
|
this.grid.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user