Skip to content

fix(reader): do not toggle bars on vertical pan swipes over fixed-layout pages - #5160

Merged
chrox merged 1 commit into
mainfrom
fix/pdf-pan-swipe-bar-toggle-5142
Jul 17, 2026
Merged

fix(reader): do not toggle bars on vertical pan swipes over fixed-layout pages#5160
chrox merged 1 commit into
mainfrom
fix/pdf-pan-swipe-bar-toggle-5142

Conversation

@chrox

@chrox chrox commented Jul 17, 2026

Copy link
Copy Markdown
Member

Fixes #5142

Root cause

On paginated fixed-layout books, the swipe-up gesture that toggles the header and footer bars was gated by zoomLevel <= 100 in useIframeEvents.ts. Zoom level is a poor proxy for whether a vertical swipe pans the page: isPanningView treats zoomMode !== 'fit-page' as pannable, and fit-width at 100% zoom in landscape overflows vertically. Every vertical pan swipe therefore also popped up the control menu.

Fix

Gate the toggle on actual vertical pannability instead: hasVerticalPanning (now exported from usePagination.ts) combines isPanningView with the renderer's real view.isOverflowY(). A vertical swipe toggles the bars only when it cannot pan the page. This also means a page zoomed beyond 100% that still fits vertically allows the swipe-up toggle again, since a vertical swipe pans nothing there.

Tests

  • New unit tests in useTouchEvent.test.tsx covering all four combinations (fit-width with and without vertical overflow, zoomed with and without vertical overflow); the overflowing fit-width case failed before the fix.
  • Full suite, lint, and format checks pass.

Device verification (Xiaomi 13, adb + CDP)

Installed a dev build with the fix and drove the real app: opened a multi-page PDF via VIEW intent, rotated to landscape, set Fit Width through the UI. Swipe-up at the left side, right side, and center left the bars hidden while the page panned; a center tap still toggles the bars both ways; with Fit Page (no vertical overflow) swipe-up still toggles the bars.

🤖 Generated with Claude Code

…out pages

The swipe-up gesture that toggles the header and footer bars was gated by
zoomLevel <= 100 on fixed-layout books. But zoom level is a poor proxy for
whether a vertical swipe pans the page: with fit-width mode at 100% zoom in
landscape the page overflows vertically, so every pan swipe also popped up
the control menu.

Gate the toggle on actual vertical pannability instead, using the renderer's
real isOverflowY() via hasVerticalPanning. A vertical swipe now toggles the
bars only when it cannot pan the page.

Fixes #5142

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chrox
chrox merged commit 6807664 into main Jul 17, 2026
11 checks passed
@chrox
chrox deleted the fix/pdf-pan-swipe-bar-toggle-5142 branch July 17, 2026 06:57
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.

PDF Control Enhancement

1 participant