From be3f53411a44c9af256f74cd4f3980005a7ccb4b Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 27 Oct 2023 14:23:53 +0200 Subject: [PATCH] Settings: Fix jumping scroll during swipe --- src/components/left/LeftColumn.tsx | 1 + src/util/swipeController.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/components/left/LeftColumn.tsx b/src/components/left/LeftColumn.tsx index f5f9ea1b4..00adccd18 100644 --- a/src/components/left/LeftColumn.tsx +++ b/src/components/left/LeftColumn.tsx @@ -448,6 +448,7 @@ function LeftColumn({ return captureControlledSwipe(ref.current!, { excludedClosestSelector: '.ProfileInfo, .color-picker, .hue-picker', + selectorToPreventScroll: '#Settings .custom-scroll', onSwipeRightStart: handleReset, onCancel: () => { setContent(LeftColumnContent.Settings); diff --git a/src/util/swipeController.ts b/src/util/swipeController.ts index cbeb2a648..5d38832e3 100644 --- a/src/util/swipeController.ts +++ b/src/util/swipeController.ts @@ -18,6 +18,7 @@ let onRelease: ((onCancel: NoneToVoidFunction) => void) | undefined; export function captureControlledSwipe( element: HTMLElement, options: { excludedClosestSelector?: string; + selectorToPreventScroll?: string; onSwipeLeftStart?: NoneToVoidFunction; onSwipeRightStart?: NoneToVoidFunction; onCancel: NoneToVoidFunction; @@ -25,6 +26,7 @@ export function captureControlledSwipe( ) { return captureEvents(element, { excludedClosestSelector: options.excludedClosestSelector, + selectorToPreventScroll: options.selectorToPreventScroll, swipeThreshold: 10, onSwipe(e, direction, offsets) {