From fe787c9debae75047e6523beff2abf04f7a6b969 Mon Sep 17 00:00:00 2001 From: Hanif Tiznobake Date: Wed, 19 Apr 2023 01:21:25 -0400 Subject: [PATCH] intervention error bug: [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted. --- packages/utilities/src/scroll.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/utilities/src/scroll.ts b/packages/utilities/src/scroll.ts index 008b56bd76b2d9..4c974aefa1dcb2 100644 --- a/packages/utilities/src/scroll.ts +++ b/packages/utilities/src/scroll.ts @@ -61,16 +61,20 @@ export const allowScrollOnElement = (element: HTMLElement | null, events: EventG _element = scrollableParent; } - // if the element is scrolled to the top, - // prevent the user from scrolling up - if (_element.scrollTop === 0 && clientY > 0) { - event.preventDefault(); - } + if (event.cancelable){ + + // if the element is scrolled to the top, + // prevent the user from scrolling up + if (_element.scrollTop === 0 && clientY > 0) { + event.preventDefault(); + } - // if the element is scrolled to the bottom, - // prevent the user from scrolling down - if (_element.scrollHeight - Math.ceil(_element.scrollTop) <= _element.clientHeight && clientY < 0) { - event.preventDefault(); + // if the element is scrolled to the bottom, + // prevent the user from scrolling down + if (_element.scrollHeight - Math.ceil(_element.scrollTop) <= _element.clientHeight && clientY < 0) { + event.preventDefault(); + } + } };