Skip to content

Commit 73fbd48

Browse files
thijskramermartijnrusschen
authored andcommitted
set aria-disabled attribute when day is disabled (Hacker0x01#1880)
1 parent de392f6 commit 73fbd48

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/day.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export default class Day extends React.Component {
205205
onMouseEnter={this.handleMouseEnter}
206206
aria-label={`day-${getDate(this.props.day)}`}
207207
role="option"
208+
aria-disabled={this.isDisabled()}
208209
>
209210
{this.props.renderDayContents
210211
? this.props.renderDayContents(

test/day_test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,17 @@ describe("Day", () => {
494494
const shallowDay = renderDay(day, { excludeDates: [day] });
495495
expect(shallowDay.hasClass(className)).to.equal(true);
496496
});
497+
498+
it("should have aria-disabled attribute with true value if date is disabled", () => {
499+
const day = newDate();
500+
const shallowDay = renderDay(day, { excludeDates: [day] });
501+
expect(shallowDay.prop("aria-disabled")).to.equal(true);
502+
});
503+
504+
it("should have aria-disabled attribute with false value if date is not disabled", () => {
505+
const shallowDay = renderDay(newDate());
506+
expect(shallowDay.prop("aria-disabled")).to.equal(false);
507+
});
497508
});
498509

499510
describe("click", () => {

0 commit comments

Comments
 (0)