Skip to content

Commit 1577502

Browse files
committed
fix: address comments
1 parent 42418ba commit 1577502

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

packages/main/cypress/specs/Calendar.cy.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ describe("Calendar general interaction", () => {
136136
cy.ui5CalendarGetDay("#calendar1", "974851200")
137137
.realClick();
138138

139-
cy.focused().realPress("Tab");
140-
cy.focused().realPress("Tab");
141139
cy.focused().realPress("Tab");
142140
cy.focused().realPress("Tab");
143141
cy.focused().realPress("Space");

packages/main/src/Calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,12 @@ class Calendar extends CalendarPart {
755755
if (this._currentPicker !== "year") {
756756
this._currentPicker = "year";
757757
this.fireDecoratorEvent("show-year-view");
758-
this._focusCurrentPicker();
759758
} else {
760759
this._currentPicker = "yearrange";
761760
this.fireDecoratorEvent("show-year-range-view");
762-
this._focusCurrentPicker();
763761
}
762+
763+
this._focusCurrentPicker();
764764
}
765765

766766
_onLegendFocusOut() {

packages/main/src/DayPicker.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
403403
return dayNames.some(dayName => dayName.length > 4);
404404
}
405405

406-
_focusCorrectDay() {
406+
async _focusCorrectDay() {
407+
await renderFinished();
407408
if (this._shouldFocusDay) {
408409
this._focusableDay.focus();
409410
}
@@ -413,8 +414,7 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
413414
return document.activeElement !== this._focusableDay && this._specialCalendarDates.length === 0;
414415
}
415416

416-
async _onfocusin() {
417-
await renderFinished();
417+
_onfocusin() {
418418
this._focusCorrectDay();
419419
}
420420

@@ -727,19 +727,17 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
727727
* Called by the Calendar component.
728728
* @protected
729729
*/
730-
async _showPreviousPage() {
730+
_showPreviousPage() {
731731
this._modifyTimestampBy(-1, "month", false);
732-
await renderFinished();
733732
this._focusCorrectDay();
734733
}
735734

736735
/**
737736
* Called by the Calendar component.
738737
* @protected
739738
*/
740-
async _showNextPage() {
739+
_showNextPage() {
741740
this._modifyTimestampBy(1, "month", false);
742-
await renderFinished();
743741
this._focusCorrectDay();
744742
}
745743

@@ -750,15 +748,14 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
750748
* @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)
751749
* @private
752750
*/
753-
async _modifyTimestampBy(amount: number, unit: string, preserveDate?: boolean) {
751+
_modifyTimestampBy(amount: number, unit: string, preserveDate?: boolean) {
754752
// Modify the current timestamp
755753
this._safelyModifyTimestampBy(amount, unit, preserveDate);
756754
this._updateSecondTimestamp();
757755

758756
// Notify the calendar to update its timestamp
759757
this.fireDecoratorEvent("navigate", { timestamp: this.timestamp! });
760758

761-
await renderFinished();
762759
this._focusCorrectDay();
763760
}
764761

0 commit comments

Comments
 (0)