Skip to content

fix(reader): enable swipe chapter navigation for single-page EPUB content#655

Merged
everpcpc merged 1 commit intomainfrom
fix-scroll
Mar 13, 2026
Merged

fix(reader): enable swipe chapter navigation for single-page EPUB content#655
everpcpc merged 1 commit intomainfrom
fix-scroll

Conversation

@everpcpc
Copy link
Copy Markdown
Owner

@everpcpc everpcpc commented Mar 13, 2026

Problem

In the EPUB reader's paged scroll mode, chapters with only a single image (or any content that fits within one page) cannot be navigated via swipe gestures — only tap navigation works. This is because the WKWebView scroll view's content size equals its bounds width, leaving nothing to scroll, so scrollViewWillEndDragging never fires with meaningful velocity.

Approach

Set alwaysBounceHorizontal = true on the web view's scroll view. This allows rubber-band dragging even when content fits in a single page, which:

  • Triggers scrollViewWillEndDragging with proper velocity so the existing chapter navigation logic works
  • Provides visual feedback (bounce effect) so the user knows their swipe was recognized
  • Has no effect on multi-page chapters (already scrollable)

The vertical scroll mode (WebPubScrolledView) already sets alwaysBounceVertical = true and does not have this issue.

Testing

  • Open an EPUB with a single-image chapter in paged mode
  • Verify swipe left/right navigates to next/previous chapter
  • Verify multi-page chapters still work normally

Closes #647

…tent

When an EPUB chapter contains only a single image (or any content fitting
one page), the paged scroll view's content size equals its bounds, so the
scroll view has nothing to scroll. This means scrollViewWillEndDragging
never fires with meaningful velocity, preventing swipe-based chapter
navigation. Setting alwaysBounceHorizontal allows the rubber-band drag
even on single-page content, restoring swipe navigation and providing
visual feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@everpcpc everpcpc merged commit 982e513 into main Mar 13, 2026
3 checks passed
@everpcpc everpcpc deleted the fix-scroll branch March 13, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Epub reader's scroll mode not working properly

1 participant