Skip to content

Commit

Permalink
Merge pull request #4068 from EimantasBlazevicius/master
Browse files Browse the repository at this point in the history
aria-selected true for range selected as well
  • Loading branch information
martijnrusschen authored Jun 15, 2023
2 parents 2800dbf + 32d5409 commit 5b0000b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/day.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export default class Day extends React.Component {
role="option"
aria-disabled={this.isDisabled()}
aria-current={this.isCurrentDay() ? "date" : undefined}
aria-selected={this.isSelected()}
aria-selected={this.isSelected() || this.isInRange()}
>
{this.renderDayContents()}
</div>
Expand Down
11 changes: 11 additions & 0 deletions test/day_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ describe("Day", () => {
.getAttribute("aria-selected");
expect(ariaSelected).to.equal("true");
});

it('should set aria-selected attribute to "true" if previous and after days selected', () => {
const day = newDate();
const startDate = subDays(day, 1);
const endDate = addDays(day, 1);
const shallowDay = renderDay(day, { startDate, endDate });
const ariaSelected = mount(shallowDay.getElement())
.getDOMNode()
.getAttribute("aria-selected");
expect(ariaSelected).to.equal("true");
});
});

describe("if not selected", () => {
Expand Down

0 comments on commit 5b0000b

Please sign in to comment.