primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.37k stars 4.58k forks source link

DatePicker: "Cannot read properties of null" error when clicking on next/previous month button (18.0.0-beta.3) #16590

Open flortsch opened 4 days ago

flortsch commented 4 days ago

Describe the bug

client:489 [vite] connecting...
client:608 [vite] connected.
core.mjs:30062 Angular is running in development mode.
zone.js:1201 [Violation] 'focus' handler took 302ms
zone.js:1201 [Violation] 'focus' handler took 258ms
zone.js:1201 [Violation] 'focus' handler took 253ms
zone.js:1201 [Violation] 'click' handler took 266ms
global-error-handler.ts:10 TypeError: Cannot read properties of null (reading 'focus')
    at _DatePicker.updateFocus (primeng-datepicker.mjs:3828:217)
    at primeng-datepicker.mjs:2527:47
    at _ZoneDelegate.invoke (zone.js:369:28)
    at Object.onInvoke (core.mjs:7041:25)
    at _ZoneDelegate.invoke (zone.js:368:34)
    at _ZoneImpl.run (zone.js:111:43)
    at zone.js:2538:40
    at _ZoneDelegate.invokeTask (zone.js:402:33)
    at core.mjs:6710:49
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:6710:30)
handleError @ global-error-handler.ts:10
next @ core.mjs:33150
ConsumerObserver2.next @ Subscriber.js:90
Subscriber2._next @ Subscriber.js:59
Subscriber2.next @ Subscriber.js:32
(anonymous) @ Subject.js:41
errorContext @ errorContext.js:23
Subject2.next @ Subject.js:31
emit @ core.mjs:6583
(anonymous) @ core.mjs:7075
invoke @ zone.js:369
run @ zone.js:111
runOutsideAngular @ core.mjs:6937
onHandleError @ core.mjs:7075
handleError @ zone.js:373
runGuarded @ zone.js:124
api.microtaskDrainDone @ zone.js:2325
drainMicroTaskQueue @ zone.js:588
invokeTask @ zone.js:487
invokeTask @ zone.js:1138
globalCallback @ zone.js:1169
globalZoneAwareCallback @ zone.js:1202
Show 21 more frames
Show less
zone.js:1201 [Violation] 'click' handler took 289ms

Environment

<p-datePicker
        [dateFormat]="dateFormat"
        [ngClass]="{ 'opacity-50': readonly }"
        [showOnFocus]="!readonly"
        [id]="field.name"
        [formControlName]="field.name"
        [showIcon]="!readonly"
        [showButtonBar]="true"
        [readonlyInput]="true"
        [minDate]="minDate"
        [maxDate]="maxDate"
        dataType="string"
      >
</p-datePicker>

Reproducer

No response

Angular version

18.2.3

PrimeNG version

18.0.0-beta.3

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.20.4

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

mplgn commented 2 days ago

Continuation of #16436, which was closed and thought to be fixed for beta-3.