From 3d6547c8ac609272c0b3573d3b42244282e5d3ac Mon Sep 17 00:00:00 2001 From: liatv Date: Sun, 31 Mar 2024 14:00:56 +0300 Subject: [PATCH] verify horizontalElement when scrolling horizontal --- packages/gallery/src/components/helpers/scrollHelper.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/gallery/src/components/helpers/scrollHelper.js b/packages/gallery/src/components/helpers/scrollHelper.js index a59c86e75..0b67dfea1 100644 --- a/packages/gallery/src/components/helpers/scrollHelper.js +++ b/packages/gallery/src/components/helpers/scrollHelper.js @@ -110,7 +110,10 @@ export function scrollToGroupImp(scrollParams) { const rtlFix = isRTL ? -1 : 1; //default = scroll by half the container size - if (scrollDirection === GALLERY_CONSTS.scrollDirection.HORIZONTAL) { + if ( + scrollDirection === GALLERY_CONSTS.scrollDirection.HORIZONTAL && + horizontalElement + ) { from = horizontalElement.scrollLeft; to = from + (groupIdx * galleryWidth) / 2; // console.log('[RTL SCROLL] scrollTogroupImp: ', from, to);