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(); + } + } };