Skip to content

Autocomplete: Error when deleting input text if virtualscroll is enabled #16227

@pertsim

Description

@pertsim

Describe the bug

Since this change deleting all input text in an autocomplete component causes an error if virtual scroll is enabled.

TypeError: Cannot read properties of undefined (reading 'target') at l.onScrollPositionChange (chunk-5I3XIQUC.js:1:15922) at l.onScrollChange (chunk-5I3XIQUC.js:1:17809) at a.hide (chunk-STRRJQ3Y.js:1:33921) at chunk-STRRJQ3Y.js:1:26721 at I.<computed> (polyfills-A7MJM4D4.js:1:21056) at u.invokeTask (polyfills-A7MJM4D4.js:1:7010) at Object.onInvokeTask (chunk-XLNFN2AU.js:7:60159) at u.invokeTask (polyfills-A7MJM4D4.js:1:6931) at Y.runTask (polyfills-A7MJM4D4.js:1:2327) at invokeTask (polyfills-A7MJM4D4.js:1:8084)

Environment

PrimeNg 17.18.6

Reproducer

https://stackblitz.com/edit/1hmsvt?file=package.json

Angular version

18

PrimeNG version

17.18.8

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.14.0

Browser(s)

Chrome

Steps to reproduce the behavior

Open the page https://primeng.org/autocomplete#virtualscroll
Open the Developer Console
Enter some text into the autocomplete field
Delete all the entered text

Expected behavior

No error occurs

Metadata

Metadata

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions