diff --git a/packages/main/src/Calendar.ts b/packages/main/src/Calendar.ts index 7028f9313a37..8c9720a0cb87 100644 --- a/packages/main/src/Calendar.ts +++ b/packages/main/src/Calendar.ts @@ -52,7 +52,6 @@ interface ICalendarPicker { _showNextPage: () => void, _hasPreviousPage: () => boolean, _hasNextPage: () => boolean, - _autoFocus?: boolean, _firstYear?: number, _lastYear?: number, } @@ -441,7 +440,6 @@ class Calendar extends CalendarPart { if (defaultTypes.includes(this._selectedItemType)) { this._selectedItemType = "None"; // In order to avoid filtering of default types } - this._currentPickerDOM._autoFocus = false; } /** @@ -507,7 +505,6 @@ class Calendar extends CalendarPart { } showMonth() { - this._currentPickerDOM._autoFocus = false; this._currentPicker = "month"; } @@ -520,7 +517,6 @@ class Calendar extends CalendarPart { } showYear() { - this._currentPickerDOM._autoFocus = false; this._currentPicker = "year"; } @@ -534,10 +530,6 @@ class Calendar extends CalendarPart { */ onHeaderPreviousPress() { this._currentPickerDOM._showPreviousPage(); - - if (this.calendarLegend) { - this._currentPickerDOM._autoFocus = true; - } } /** @@ -545,10 +537,6 @@ class Calendar extends CalendarPart { */ onHeaderNextPress() { this._currentPickerDOM._showNextPage(); - - if (this.calendarLegend) { - this._currentPickerDOM._autoFocus = true; - } } _setSecondaryCalendarTypeButtonText() { @@ -641,8 +629,6 @@ class Calendar extends CalendarPart { } else { this._fireEventAndUpdateSelectedDates(e.detail.dates); } - - this._currentPickerDOM._autoFocus = true; } onSelectedYearChange(e: CustomEvent) { @@ -655,8 +641,6 @@ class Calendar extends CalendarPart { } else { this._fireEventAndUpdateSelectedDates(e.detail.dates); } - - this._currentPickerDOM._autoFocus = true; } onNavigate(e: CustomEvent) { diff --git a/packages/main/src/DayPicker.ts b/packages/main/src/DayPicker.ts index 196cf8b12f42..e89851071276 100644 --- a/packages/main/src/DayPicker.ts +++ b/packages/main/src/DayPicker.ts @@ -191,8 +191,6 @@ class DayPicker extends CalendarPart implements ICalendarPicker { @property({ type: Array }) specialCalendarDates: Array = []; - _autoFocus?: boolean; - @i18n("@ui5/webcomponents") static i18nBundle: I18nBundle; @@ -401,10 +399,6 @@ class DayPicker extends CalendarPart implements ICalendarPicker { } onAfterRendering() { - if (this._autoFocus && !this._hidden) { - this.focus(); - } - const focusedDay = this.shadowRoot!.querySelector("[data-sap-focus-ref]"); if (focusedDay && document.activeElement !== focusedDay && this._specialCalendarDates.length === 0) { @@ -412,14 +406,6 @@ class DayPicker extends CalendarPart implements ICalendarPicker { } } - _onfocusin() { - this._autoFocus = true; - } - - _onfocusout() { - this._autoFocus = false; - } - /** * Tells if the day is selected (dark blue). * @param timestamp diff --git a/packages/main/src/DayPickerTemplate.tsx b/packages/main/src/DayPickerTemplate.tsx index 6e9735d12493..b20681b6ff41 100644 --- a/packages/main/src/DayPickerTemplate.tsx +++ b/packages/main/src/DayPickerTemplate.tsx @@ -15,8 +15,6 @@ export default function DayPickerTemplate(this: DayPicker) { onKeyUp={this._onkeyup} onClick={this._onclick} onMouseOver={this._onmouseover} - onFocusIn={this._onfocusin} - onFocusOut={this._onfocusout} >
diff --git a/packages/main/test/specs/DatePicker.spec.js b/packages/main/test/specs/DatePicker.spec.js index 23e2a2894bb5..86777824f452 100644 --- a/packages/main/test/specs/DatePicker.spec.js +++ b/packages/main/test/specs/DatePicker.spec.js @@ -955,9 +955,9 @@ describe("Date Picker Tests", () => { it("DayPiker day number attribute", async () => { await browser.url(`test/pages/DatePicker_test_page.html?sap-ui-language=en`); + datepicker.id = "#dp13"; const root = await datepicker.getRoot(); await root.setAttribute("primary-calendar-type", "Gregorian"); - datepicker.id = "#dp13"; await datepicker.openPicker(); await root.keys("May 3, 2100"); await root.keys("Enter"); @@ -992,9 +992,9 @@ describe("Date Picker Tests", () => { const data = Array.from(await datepicker.getDayPickerDatesRow(2)); assert.strictEqual(await data[0].getAttribute("aria-label"), "Calendar Week 19", "First columnheader have Week number aria-label"); - assert.strictEqual(await data[1].getAttribute("aria-label"), "Non-Working Day May 2, 2100", "Each date have the full date's info in Month Date, Year in aria-label"); - assert.strictEqual(await data[2].getAttribute("aria-label"), "May 3, 2100", "Each date have the full date's info in Month Date, Year in aria-label"); - assert.strictEqual(await data[3].getAttribute("aria-label"), "May 4, 2100", "Each date have the full date's info in Month Date, Year in aria-label"); + assert.strictEqual(await data[1].getAttribute("aria-label"), "May 2, 2100 Non-Working Day ", "Each date have the full date's info in Month Date, Year in aria-label"); + assert.strictEqual(await data[2].getAttribute("aria-label"), "May 3, 2100 ", "Each date have the full date's info in Month Date, Year in aria-label"); + assert.strictEqual(await data[3].getAttribute("aria-label"), "May 4, 2100 ", "Each date have the full date's info in Month Date, Year in aria-label"); await datepicker.closePicker(); }); @@ -1284,9 +1284,9 @@ describe("Date Picker Tests", () => { assert.ok(await monthPicker.getAttribute("hidden")); assert.notOk(await yearPicker.getAttribute("hidden")); - const timestamp_2014 = 1388534400; - const calendarDate_2014 = await datepicker.getPickerYear(timestamp_2014); - await calendarDate_2014.click(); + const timestamp_2015 = 1420070400; + const calendarDate_2015 = await datepicker.getPickerYear(timestamp_2015); + await calendarDate_2015.click(); assert.isFalse(await datepicker.isPickerOpen(), "picker is closed after year selection"); }); @@ -1414,7 +1414,7 @@ describe("Date Picker Tests", () => { }); describe("Legacy date customization", () => { - it.only("Customization of legacy dates in Islamic calendar", async () => { + it("Customization of legacy dates in Islamic calendar", async () => { // According to the Islamic calendar, Rab. I 9, 1446 AH should be displayed on Thursday, // but it needs to be configured using the legacyDateCalendarCustomizing setting. datepicker.page = "test/pages/DatePicker_legacy_test_page.html";