Skip to content

Commit 5fdaba2

Browse files
fix(datetime): days keep in focus after changing the month (#31021)
Issue number: internal --------- ## What is the current behavior? In Android native, when a user places a day in focus and then changes the month by dragging the month, the div previous on focus remains in focus in the new month. ## What is the new behavior? After changing the month, the focus is removed from the active element and placed on the calendar ## Does this introduce a breaking change? - [ ] Yes - [ ] No ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: Shane <shane@shanessite.net>
1 parent f04fa23 commit 5fdaba2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/components/datetime/datetime.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,11 @@ export class Datetime implements ComponentInterface {
10331033
if (this.resolveForceDateScrolling) {
10341034
this.resolveForceDateScrolling();
10351035
}
1036+
1037+
const activeEl = this.el.shadowRoot!.activeElement as HTMLElement | null;
1038+
if (activeEl && activeEl.classList.contains('calendar-day')) {
1039+
(activeEl.closest('.calendar-body') as HTMLElement | null)?.focus();
1040+
}
10361041
});
10371042
};
10381043

0 commit comments

Comments
 (0)