From 39414e6caba4830192a54ea9553bcda36959c9bf Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Tue, 30 May 2023 19:52:41 +0530 Subject: [PATCH] fix: Fixed issue where pane gestures on Android would break scroll in a daily journal tag --- .../web/src/javascripts/Components/Panes/usePaneGesture.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts index 03f336615..4d5d75e46 100644 --- a/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts +++ b/packages/web/src/javascripts/Components/Panes/usePaneGesture.ts @@ -83,6 +83,7 @@ export const usePaneSwipeGesture = ( let moveTimestamp = startTimestamp let closestScrollContainer: HTMLElement | null let scrollContainerAxis: 'x' | 'y' | null = null + let scrollContainerInitialOverflowY: string | null = null let canceled = false const TouchMoveThreshold = requiresStartFromEdge ? 25 : 45 @@ -105,6 +106,7 @@ export const usePaneSwipeGesture = ( startTimestamp = Date.now() moveTimestamp = startTimestamp scrollContainerAxis = null + scrollContainerInitialOverflowY = null canceled = false const touch = event.touches[0] @@ -121,6 +123,7 @@ export const usePaneSwipeGesture = ( closestScrollContainer = getScrollParent(event.target as HTMLElement) if (closestScrollContainer) { + scrollContainerInitialOverflowY = closestScrollContainer.style.overflowY closestScrollContainer.addEventListener('scroll', scrollListener, supportsPassive ? { passive: true } : false) if (closestScrollContainer.scrollWidth > closestScrollContainer.clientWidth) { @@ -249,7 +252,9 @@ export const usePaneSwipeGesture = ( const touchEndListener = () => { if (closestScrollContainer) { closestScrollContainer.removeEventListener('scroll', scrollListener) - closestScrollContainer.style.overflowY = '' + if (closestScrollContainer.style.overflowY === 'hidden') { + closestScrollContainer.style.overflowY = scrollContainerInitialOverflowY || '' + } } if (canceled) {