From 802079ef3de747507c36189de35bc92576aa9591 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:52:57 +0200 Subject: [PATCH] Fix infinite scroll open previous/next chapter Regression 53c24280c382a848c335c625e84b6923a844aae1 --- CHANGELOG.md | 2 +- .../useReaderInfiniteScrollUpdateChapter.ts | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dab6063c..8a40d82c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Reader**) Fix mobile progress bar previous/next chapter button visibility on hover and while disabled - (**Reader**) Fix jumping back to the first page on window resize - (**Reader**) Fix chapter not getting marked as read in continuous reading mode in case the last page is not big enough to get marked as the current page -- (**Reader**) Fix infinite scrolling with disabled transition page +- (**Reader**) Fix infinite scrolling sometimes not opening previous/next chapter - (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled ## [20260509.01] (r3147) - 2026-05-09 diff --git a/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts b/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts index 70af0656..b6f23e48 100644 --- a/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts +++ b/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts @@ -271,13 +271,19 @@ export const useReaderInfiniteScrollUpdateChapter = ( } const onScroll = () => { + const THRESHOLD = 2; + const isAtStartX = scrollElement.scrollLeft === 0; - const isAtEndX = - Math.ceil(scrollElement.scrollLeft) === scrollElement.scrollWidth - scrollElement.clientWidth; + const distanceEndX = Math.abs( + Math.abs(scrollElement.scrollLeft) - (scrollElement.scrollWidth - scrollElement.clientWidth), + ); + const isAtEndX = distanceEndX >= 0 && distanceEndX <= THRESHOLD; const isAtStartY = scrollElement.scrollTop === 0; - const isAtEndY = - Math.ceil(scrollElement.scrollTop) === scrollElement.scrollHeight - scrollElement.clientHeight; + const distanceStartY = Math.abs( + Math.abs(scrollElement.scrollTop) - (scrollElement.scrollHeight - scrollElement.clientHeight), + ); + const isAtEndY = distanceStartY >= 0 && distanceStartY <= THRESHOLD; const isAtStart = isContinuousVerticalReadingModeActive ? isAtStartY : isAtStartX; const isAtEnd = isContinuousVerticalReadingModeActive ? isAtEndY : isAtEndX;