Skip to content

Commit e0e2290

Browse files
authored
Merge pull request #6840 from IgniteUI/reset-scrollAmount-m
Reset scrollComponent scrollAmount, if scrollbar is hidden
2 parents 002a950 + 8027ea4 commit e0e2290

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,15 +1185,18 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
11851185
this.scrollComponent.size = totalWidth;
11861186
if (totalWidth <= parseInt(this.igxForContainerSize, 10)) {
11871187
this.scrollPosition = 0;
1188+
// Need to reset the scrollAmount value here, because horizontalScrollBar is hidden, therefore
1189+
// onScroll event handler for VirtualHelperBaseDirective will not be called
1190+
this.scrollComponent.scrollAmount = 0;
11881191
}
11891192
}
11901193
if (this.igxForScrollOrientation === 'vertical') {
11911194
this.scrollComponent.nativeElement.style.height = parseInt(this.igxForContainerSize, 10) + 'px';
11921195
this.scrollComponent.size = this._calcHeight();
11931196
if ( this.scrollComponent.size <= parseInt(this.igxForContainerSize, 10)) {
11941197
this.scrollPosition = 0;
1195-
// Need to reset the scrollAmount value here, because
1196-
// Firefox will not fire the scrollComponent scroll event handler
1198+
// Need to reset the scrollAmount value here, because verticalScrollBar is hidden, therefore
1199+
// onScroll event handler for VirtualHelperBaseDirective will not be called
11971200
this.scrollComponent.scrollAmount = 0;
11981201
}
11991202
}

0 commit comments

Comments
 (0)