Skip to content

Commit

Permalink
Merge pull request #11 from ntdb/accessibility
Browse files Browse the repository at this point in the history
Accessibility
  • Loading branch information
ntdb authored Oct 26, 2016
2 parents 454a3b3 + 35b35d9 commit c167fd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/WeekdayPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WeekdayPicker extends Component {
tabIndex: PropTypes.number,

modifiers: PropTypes.object,
ariaModifier: PropTypes.string,

locale: PropTypes.string,
localeUtils: PropTypes.shape({
Expand All @@ -34,7 +35,8 @@ class WeekdayPicker extends Component {
static defaultProps = {
tabIndex: 0,
locale: "en",
localeUtils: localeUtils
localeUtils: localeUtils,
ariaModifier: 'selected'
}

getModifiersForDay(d, modifierFunctions) {
Expand Down Expand Up @@ -101,6 +103,8 @@ class WeekdayPicker extends Component {

className += modifiers.map(modifier => ` ${className}--${modifier}`).join("");

const ariaSelected = modifiers.indexOf(this.props.ariaModifier) > -1;

const { onWeekdayMouseEnter, onWeekdayMouseLeave, onWeekdayTouchTap, onWeekdayClick }
= this.props;
let tabIndex = null;
Expand All @@ -122,6 +126,7 @@ class WeekdayPicker extends Component {
(e) => this.handleWeekdayClick(e, weekday, modifiers) : null }
onTouchTap= { onWeekdayTouchTap ?
(e) => this.handleWeekdayTouchTap(e, weekday, modifiers) : null }
aria-selected={ariaSelected}
>
<attr title={localeUtils.formatWeekdayLong(weekday, locale)}>
{ localeUtils.formatWeekdayShort(weekday, locale) }
Expand Down

0 comments on commit c167fd1

Please sign in to comment.