Skip to content

Commit

Permalink
Date Picker Dialog Example: Fix bug where space does not set aria-sel…
Browse files Browse the repository at this point in the history
…ect (pull #1494)

When a date cell in the date grid had focus and space key was pressed, content of date input field was updated with the selected date, but aria-select was not set true on the selected date.
This commit fixes the space key behavior.

Co-authored-by: Matt King <a11yThinker@Gmail.com>
  • Loading branch information
jongund and mcking65 committed Sep 1, 2020
1 parent caba008 commit 145097b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/dialog-modal/js/datepicker-dialog.js
Expand Up @@ -301,6 +301,8 @@ DatePickerDialog.prototype.setTextboxDate = function (domNode) {

if (domNode) {
d = this.getDayFromDataDateAttribute(domNode);
// updated aria-selected
this.days.forEach(day => day === domNode ? day.setAttribute('aria-selected', 'true') : day.removeAttribute('aria-selected'));
}

this.textboxNode.value = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
Expand Down

0 comments on commit 145097b

Please sign in to comment.