@@ -99,7 +99,9 @@ function Datepicker() {
99
99
firstDay : 0 , // The first day of the week, Sun = 0, Mon = 1, ...
100
100
isRTL : false , // True if right-to-left language, false if left-to-right
101
101
showMonthAfterYear : false , // True if the year select precedes month, false for month then year
102
- yearSuffix : "" // Additional text to append to the year in the month headers
102
+ yearSuffix : "" , // Additional text to append to the year in the month headers,
103
+ selectMonthLabel : "Select month" , // Invisible label for month selector
104
+ selectYearLabel : "Select year" // Invisible label for year selector
103
105
} ;
104
106
this . _defaults = { // Global defaults for all the date picker instances
105
107
showOn : "focus" , // "focus" for popup on focus,
@@ -1910,7 +1912,8 @@ $.extend( Datepicker.prototype, {
1910
1912
( printDate . getTime ( ) === today . getTime ( ) ? " ui-state-highlight" : "" ) +
1911
1913
( printDate . getTime ( ) === currentDate . getTime ( ) ? " ui-state-active" : "" ) + // highlight selected day
1912
1914
( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
1913
- "' href='#'>" + printDate . getDate ( ) + "</a>" ) ) + "</td>" ; // display selectable date
1915
+ "' href='#' aria-current='" + ( printDate . getTime ( ) === currentDate . getTime ( ) ? "true" : "false" ) + // mark date as selected for screen reader
1916
+ "'>" + printDate . getDate ( ) + "</a>" ) ) + "</td>" ; // display selectable date
1914
1917
printDate . setDate ( printDate . getDate ( ) + 1 ) ;
1915
1918
printDate = this . _daylightSavingAdjust ( printDate ) ;
1916
1919
}
@@ -1940,6 +1943,8 @@ $.extend( Datepicker.prototype, {
1940
1943
changeMonth = this . _get ( inst , "changeMonth" ) ,
1941
1944
changeYear = this . _get ( inst , "changeYear" ) ,
1942
1945
showMonthAfterYear = this . _get ( inst , "showMonthAfterYear" ) ,
1946
+ selectMonthLabel = this . _get ( inst , "selectMonthLabel" ) ,
1947
+ selectYearLabel = this . _get ( inst , "selectYearLabel" ) ,
1943
1948
html = "<div class='ui-datepicker-title'>" ,
1944
1949
monthHtml = "" ;
1945
1950
@@ -1949,7 +1954,7 @@ $.extend( Datepicker.prototype, {
1949
1954
} else {
1950
1955
inMinYear = ( minDate && minDate . getFullYear ( ) === drawYear ) ;
1951
1956
inMaxYear = ( maxDate && maxDate . getFullYear ( ) === drawYear ) ;
1952
- monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>" ;
1957
+ monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
1953
1958
for ( month = 0 ; month < 12 ; month ++ ) {
1954
1959
if ( ( ! inMinYear || month >= minDate . getMonth ( ) ) && ( ! inMaxYear || month <= maxDate . getMonth ( ) ) ) {
1955
1960
monthHtml += "<option value='" + month + "'" +
@@ -1984,7 +1989,7 @@ $.extend( Datepicker.prototype, {
1984
1989
endYear = Math . max ( year , determineYear ( years [ 1 ] || "" ) ) ;
1985
1990
year = ( minDate ? Math . max ( year , minDate . getFullYear ( ) ) : year ) ;
1986
1991
endYear = ( maxDate ? Math . min ( endYear , maxDate . getFullYear ( ) ) : endYear ) ;
1987
- inst . yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>" ;
1992
+ inst . yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
1988
1993
for ( ; year <= endYear ; year ++ ) {
1989
1994
inst . yearshtml += "<option value='" + year + "'" +
1990
1995
( year === drawYear ? " selected='selected'" : "" ) +
0 commit comments