Skip to content

Commit

Permalink
Inherit mobile input accessibility attributes from base
Browse files Browse the repository at this point in the history
#accessibility
  • Loading branch information
aduth committed May 26, 2017
1 parent 039ca08 commit e81b4a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/date-picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ export default class DatePicker extends Component {
// By default, Flatpickr intializes to the browser-offset date. Update
// the value and force a redraw (to reapply the "today" class)
this.flatpickr.now = toSiteTime( new Date() );

// Override Flatpickr's mobile accessibility attributes to inherit more
// from the base input element
const { input, mobileInput } = this.flatpickr;
if ( mobileInput ) {
mobileInput.removeAttribute( 'tabindex' );
mobileInput.setAttribute( 'aria-label', input.getAttribute( 'aria-label' ) );
input.setAttribute( 'aria-hidden', 'true' );
}

this.flatpickr.redraw();
}

Expand Down

0 comments on commit e81b4a0

Please sign in to comment.