Skip to content

Commit 0b915d6

Browse files
authored
fix(ui5-calendar): year button accessibility (SAP#9255)
Fixes: SAP#9107
1 parent 63c3868 commit 0b915d6

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

packages/main/src/Calendar.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,14 @@ class Calendar extends CalendarPart {
591591
return this._currentPicker === "month" || this._currentPicker === "year";
592592
}
593593

594+
/**
595+
* The year button is hidden when the year picker is shown
596+
* @private
597+
*/
598+
get _isHeaderYearButtonHidden(): boolean {
599+
return this._currentPicker === "year";
600+
}
601+
594602
get _isDayPickerHidden() {
595603
return this._currentPicker !== "day";
596604
}

packages/main/src/CalendarHeader.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<div
3030
data-ui5-cal-header-btn-year
3131
class="ui5-calheader-arrowbtn ui5-calheader-middlebtn"
32+
?hidden="{{_isHeaderYearButtonHidden}}"
3233
tabindex="0"
3334
role="button"
3435
@click={{onHeaderShowYearPress}}

packages/main/test/specs/Calendar.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,16 @@ describe("Calendar general interaction", () => {
431431

432432
assert.strictEqual(specialDate.length, 1, "Special date is rendered");
433433
});
434+
435+
it("Calendar header buttons visibility", async () => {
436+
const calendarHeader = await browser.$("#calendar1").shadow$(".ui5-calheader");
437+
const monthButton = await calendarHeader.shadow$(`[data-ui5-cal-header-btn-month]`);
438+
const yearButton = await calendarHeader.shadow$(`[data-ui5-cal-header-btn-year]`);
439+
440+
await monthButton.click();
441+
assert.ok(monthButton.hasAttribute("hidden"), "The month button is hidden");
442+
443+
await yearButton.click();
444+
assert.ok(yearButton.hasAttribute("hidden"), "The year button is hidden");
445+
});
434446
});

0 commit comments

Comments
 (0)