Datepicker: Only apply the ui-state-focus class name to one cell

This is specifically for multi month pickers. This makes the assumption that
the keyboard is always interacting with the first month in a multi month
calendar. The next step is to store which grid currently has focus and to base
the focus logic off of that.
This commit is contained in:
TJ VanToll 2013-10-30 09:11:06 -04:00 committed by Scott González
parent 9ec69ccb73
commit 9bdb4783fd

View File

@ -166,8 +166,8 @@ $.widget( "ui.datepicker", {
this.grid.attr("aria-activedescendant", newId);
activeCell.children("a").removeClass("ui-state-focus");
newCell.children("a").addClass("ui-state-focus");
this.grid.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
newCell.children( "a" ).addClass( "ui-state-focus" );
}
},
_createPicker: function() {
@ -538,6 +538,10 @@ $.widget( "ui.datepicker", {
}
this.date.adjust( "M", -this.options.numberOfMonths );
// TODO: This assumes focus is on the first grid. For multi pickers, the widget needs
// to maintain the currently focused grid and base queries like this off of it.
$( this.picker ).find( ".ui-state-focus" ).not( ":first" ).removeClass( "ui-state-focus" );
},
open: function( event ) {
if ( this.inline || this.isOpen ) {