Skip to content

Commit

Permalink
Fix aria role for calendar dates
Browse files Browse the repository at this point in the history
  • Loading branch information
samiheikki committed Oct 28, 2018
1 parent ab7ed98 commit 3111cf1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-month-calendar.html
Expand Up @@ -329,7 +329,7 @@
}

_getRole(date) {
return date ? 'button' : 'presentational';
return date ? 'button' : 'presentation';
}

_getAriaLabel(date) {
Expand Down
9 changes: 9 additions & 0 deletions test/wai-aria.html
Expand Up @@ -291,6 +291,15 @@
});
});

it('should have presentation roles on empty date cells', () => {
var emptyDateElements = monthCalendar.root.querySelectorAll('[part="date"]:empty');

Array.prototype.forEach.call(emptyDateElements, emptyElement => {
expect(emptyElement.getAttribute('role')).to.equal('presentation');
expect(emptyElement.getAttribute('aria-label')).to.be.empty;
});
});

describe('week numbers', () => {
beforeEach(done => {
monthCalendar.showWeekNumbers = true;
Expand Down

0 comments on commit 3111cf1

Please sign in to comment.