From 8952923803b6326127c4e33ae197f8ae95417c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=87etin?= <92744169+mehmetcetin01140@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:59:02 +0300 Subject: [PATCH] Fixed #16720 | DatePicker Component - Error on Month Switch: Cannot read properties of null (reading focus) --- packages/primeng/src/datepicker/datepicker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/primeng/src/datepicker/datepicker.ts b/packages/primeng/src/datepicker/datepicker.ts index 0586ef9ef53..640823962ae 100644 --- a/packages/primeng/src/datepicker/datepicker.ts +++ b/packages/primeng/src/datepicker/datepicker.ts @@ -2546,8 +2546,8 @@ export class DatePicker extends BaseComponent implements OnInit, OnDestroy, Cont if (this.navigationState.button) { this.initFocusableCell(); - if (this.navigationState.backward) (findSingle(this.contentViewChild.nativeElement, '.p-datepicker-prev') as any).focus(); - else (findSingle(this.contentViewChild.nativeElement, '.p-datepicker-next') as any).focus(); + if (this.navigationState.backward) (findSingle(this.contentViewChild.nativeElement, '.p-datepicker-prev-button') as any).focus(); + else (findSingle(this.contentViewChild.nativeElement, '.p-datepicker-next-button') as any).focus(); } else { if (this.navigationState.backward) { let cells; @@ -3753,7 +3753,7 @@ export class DatePicker extends BaseComponent implements OnInit, OnDestroy, Cont } isNavIconClicked(event: any) { - return hasClass(event.target, 'p-datepicker-prev') || hasClass(event.target, 'p-datepicker-prev-icon') || hasClass(event.target, 'p-datepicker-next') || hasClass(event.target, 'p-datepicker-next-icon'); + return hasClass(event.target, 'p-datepicker-prev-button') || hasClass(event.target, 'p-datepicker-prev-icon') || hasClass(event.target, 'p-datepicker-next-button') || hasClass(event.target, 'p-datepicker-next-icon'); } onWindowResize() {