Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. Take a look
#### Navigator

* The `AudioNavigator` now resumes by itself after the network stalls, instead of stopping until the app returns to the foreground when it is in the background.
* The EPUB navigator no longer opens a paginated reflowable resource on its first page instead of the requested location, when the web view is slow to render its first frames.


## [4.0.0-alpha.3] - 2026-11-16
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Sources/Navigator/EPUB/Scripts/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ function scrollTo({ left, top, animated } = {}) {
function snapOffset(offset) {
const delta = isRTL() ? -1 : 1;
const value = offset + delta;
return value - (value % viewportWidth);
// `viewportWidth` is only set once the `ResizeObserver` callback ran, a
// frame after the page is rendered. The native side may already scroll
// to the initial location before that, and a modulo by 0 would yield
// `NaN`, an offset `scrollTo()` doesn't move the page to.
const pageWidth = viewportWidth || window.innerWidth;
return value - (value % pageWidth);
}

function snapCurrentPosition() {
Expand Down