Skip to content

Fix currentLocator not updating after changing EPUB preferences - #819

Draft
mickael-menu wants to merge 1 commit into
developfrom
fix-issue-761
Draft

mickael-menu wants to merge 1 commit into
developfrom
fix-issue-761

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

In the legacy EPUB navigator, changing reading preferences that trigger a relayout (e.g. font size) did not emit a new currentLocator. Apps persisting the locator to restore the reading position would reopen the publication pages away from where the user left off.

The JS ResizeObserver already reacted to content relayouts to snap the scroll offset, but never notified the native side — unlike the Swift toolkit, where it posts a progressionChanged message after every relayout. This adds an Android.onContentSizeChanged() bridge call in that observer, which triggers the existing (debounced and guarded) notifyCurrentLocation() path to emit a locator reflecting the actual position after the reflow. JS bundles regenerated with make scripts.

Note: re-anchoring to the exact pre-change position (readium/swift-toolkit#645) is out of scope; the emitted locator reflects where the reflow actually leaves the user.

Needs on-device verification: change font size → close → reopen should preserve the position (within a page), in paginated and scroll modes; sanity-check an FXL publication and rotation for spurious emissions.

Fixes #761

🤖 Generated with Claude Code

In the legacy EPUB navigator, changing reading preferences that trigger
a relayout (e.g. font size) did not emit a new currentLocator. Apps
persisting the locator to restore the reading position would reopen the
publication pages away from where the user left off.

The JS ResizeObserver already reacted to content relayouts to snap the
scroll offset, but never notified the native side - unlike the Swift
toolkit, where it posts a progressionChanged message. Add an
Android.onContentSizeChanged() bridge call in that observer, which
triggers the existing debounced and guarded notifyCurrentLocation()
path to emit a locator reflecting the actual position after the reflow.

Fixes #761

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Changing reading preferences does not emit a new Locator

1 participant