Scroller: When itemSize is not set, scrolling to top results in component crash #15395
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When the property [itemSize] is not set in the html component, scrolling to top results in component crash. The scroller doesn't get shown anymore.
The reason for that is that these lines result in a NaN, because they divide by zero.
primeng/src/app/components/scroller/scroller.ts
Line 886 in 1b589db
primeng/src/app/components/scroller/scroller.ts
Line 756 in 1b589db
primeng/src/app/components/scroller/scroller.ts
Line 724 in 1b589db
There are as far as I can tell, three possible fixes:
Environment
tested with Chrome and Firefox
Reproducer
No response
Angular version
17.3.6
PrimeNG version
17.15.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.11.1
Browser(s)
No response
Steps to reproduce the behavior
write a component like this
<p-scroller [items]="itemList" [autoSize]="true" [scrollHeight]="200px"> bla </p-scroller>
Expected behavior
well... component should'nt break
The text was updated successfully, but these errors were encountered: