Skip to content

Commit e095f2b

Browse files
authored
Merge pull request #5426 from IgniteUI/mkirova/fix-5200
chore(*): Prevent event default only on touchMove, for other events j…
2 parents 56d9ee8 + ffc4c7e commit e095f2b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,22 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
141141
this._scrollToY(
142142
this._startY + scrollDeltaY * scrollStep
143143
);
144-
this.preventParentScroll(evt);
144+
this.preventParentScroll(evt, true);
145145
}
146146
}
147147

148148
/**
149149
* @hidden
150150
* When there is still room to scroll up/down prevent the parent elements from scrolling too.
151151
*/
152-
protected preventParentScroll(evt) {
152+
protected preventParentScroll(evt, preventDefault) {
153153
const curScrollTop = this.IgxScrollInertiaScrollContainer.scrollTop;
154154
const maxScrollTop = this.IgxScrollInertiaScrollContainer.children[0].scrollHeight -
155155
this.IgxScrollInertiaScrollContainer.offsetHeight;
156156
if (0 < curScrollTop && curScrollTop < maxScrollTop) {
157-
evt.preventDefault();
157+
if (preventDefault) {
158+
evt.preventDefault();
159+
}
158160
if (evt.stopPropagation) {
159161
evt.stopPropagation();
160162
}
@@ -195,7 +197,7 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
195197

196198
this._touchPrevented = false;
197199
if (this.IgxScrollInertiaDirection === 'vertical') {
198-
this.preventParentScroll(event);
200+
this.preventParentScroll(event, false);
199201
}
200202
}
201203

@@ -273,7 +275,7 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
273275

274276
// On Safari preventing the touchmove would prevent default page scroll behaviour even if there is the element doesn't have overflow
275277
if (this.IgxScrollInertiaDirection === 'vertical') {
276-
this.preventParentScroll(event);
278+
this.preventParentScroll(event, true);
277279
}
278280
}
279281

@@ -298,7 +300,7 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
298300
this._inertiaInit(speedX, speedY);
299301
}
300302
if (this.IgxScrollInertiaDirection === 'vertical') {
301-
this.preventParentScroll(event);
303+
this.preventParentScroll(event, false);
302304
}
303305
}
304306

projects/igniteui-angular/src/lib/grids/grid-base.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,6 +2723,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
27232723
const vertScrDC = this.verticalScrollContainer.dc.instance._viewContainer.element.nativeElement;
27242724
vertScrDC.addEventListener('scroll', (evt) => { this.scrollHandler(evt); });
27252725
vertScrDC.addEventListener('wheel', () => { this.wheelHandler(); });
2726+
vertScrDC.addEventListener('touchmove', () => { this.wheelHandler(); });
27262727

27272728
this.verticalScrollContainer.onDataChanging.pipe(takeUntil(this.destroy$)).subscribe(($event) => {
27282729
this.calculateGridHeight();

0 commit comments

Comments
 (0)