Skip to content

Commit 4e7ebb1

Browse files
ddariborkaraivanov
andauthored
fix(calendar): address ARIA violation when a week with all days hidden is rendered (#1637)
--------- Co-authored-by: Radoslav Karaivanov <[email protected]>
1 parent 75b5498 commit 4e7ebb1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/components/calendar/calendar-rendering.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ describe('Calendar Rendering', () => {
2525
await expect(calendar).shadowDom.to.be.accessible();
2626
});
2727

28+
it('passes the a11y audit when a week of hidden days is rendered - issue #1636', async () => {
29+
const aprilFirst2025 = new CalendarDay({ year: 2025, month: 3, date: 1 });
30+
calendar.activeDate = aprilFirst2025.native;
31+
calendar.visibleMonths = 2;
32+
await elementUpdated(calendar);
33+
34+
await expect(calendar).dom.to.be.accessible();
35+
await expect(calendar).shadowDom.to.be.accessible();
36+
});
37+
2838
it('renders the calendar successfully', async () => {
2939
const today = CalendarDay.today.native;
3040
const day = new Intl.DateTimeFormat('en', { weekday: 'short' }).format(

src/components/calendar/days-view/days-view.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ export default class IgcDaysViewComponent extends EventEmitterMixin<
481481
const last = weeks.length - 1;
482482

483483
for (const [idx, week] of weeks.entries()) {
484+
let hidden = false;
485+
if (idx === 0 || idx === last) {
486+
hidden = week.every((day) => this.getDayProperties(day, today).hidden);
487+
}
484488
yield html`
485-
<div role="row" part="days-row">
489+
<div role="row" part="days-row" aria-hidden=${hidden}>
486490
${this.showWeekNumbers
487491
? this.renderWeekNumber(week[0], idx === last)
488492
: nothing}

0 commit comments

Comments
 (0)