[PR #4548] Patching epubjs to scroll to correct location on CFI load #4282

Open
opened 2026-04-25 00:19:07 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4548
Author: @SFenton
Created: 7/30/2025
Status: 🔄 Open

Base: masterHead: master


📝 Commits (4)

  • a498fdf Fix EPUB.js CFI navigation bug
  • d41af77 Merge pull request #1 from SFenton/feature/epubjs-cfi-navigation-fix
  • 63e39a1 package-lock update
  • 8a81ce6 Merge pull request #2 from SFenton/users/stefen/package-update

📊 Changes

3 files changed (+230 additions, -747 deletions)

View changed files

📝 client/package-lock.json (+190 -746)
📝 client/package.json (+3 -1)
client/patches/epubjs+0.3.93.patch (+37 -0)

📄 Description

Brief summary

Currently, if a mobile reader generates a valid CFI and posts it back to the server, the server can load it, and even if it's valid, epubjs can actually navigate to the wrong place (where content is not visible)- even if that place is nearby.

To fix this, we change the scrolling mechanism to use scrollTo instead of scrollBy.

scrollTo should get us to the actual visible position of the CFI's element; scrollBy scrolls to an offset.

Note that I've tested this in a local app I quickly built that uses epubjs; I need some assistance in testing it in an actual ABS instance, unfortunately.

In-depth Description

  • Generate a patch file for epubjs that should scroll us to the right spot
  • Install the patch on postinstall of packages
  • Validate that epubjs now scrolls to the correct location.

How have you tested this?

Unfortunately, I have not been able to test on ABS itself. I need some help in doing that.

I built a quick web app with epubjs and validated this behavior both pre- and post-patch.

Screenshots


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4548 **Author:** [@SFenton](https://github.com/SFenton) **Created:** 7/30/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (4) - [`a498fdf`](https://github.com/advplyr/audiobookshelf/commit/a498fdf17d2e543b44d71637adcae668acce3194) Fix EPUB.js CFI navigation bug - [`d41af77`](https://github.com/advplyr/audiobookshelf/commit/d41af7765850c2a92cc8471bc36407d1c18b45ab) Merge pull request #1 from SFenton/feature/epubjs-cfi-navigation-fix - [`63e39a1`](https://github.com/advplyr/audiobookshelf/commit/63e39a128bcda9f2aac52510703ccccdd29d5eba) package-lock update - [`8a81ce6`](https://github.com/advplyr/audiobookshelf/commit/8a81ce6102f144fde239f56b9add750eab7f82ad) Merge pull request #2 from SFenton/users/stefen/package-update ### 📊 Changes **3 files changed** (+230 additions, -747 deletions) <details> <summary>View changed files</summary> 📝 `client/package-lock.json` (+190 -746) 📝 `client/package.json` (+3 -1) ➕ `client/patches/epubjs+0.3.93.patch` (+37 -0) </details> ### 📄 Description ## Brief summary Currently, if a mobile reader generates a valid CFI and posts it back to the server, the server can load it, and even if it's valid, epubjs can actually navigate to the wrong place (where content is not visible)- even if that place is nearby. To fix this, we change the scrolling mechanism to use scrollTo instead of scrollBy. scrollTo should get us to the actual visible position of the CFI's element; scrollBy scrolls to an offset. Note that I've tested this in a local app I quickly built that uses epubjs; I need some assistance in testing it in an actual ABS instance, unfortunately. ## In-depth Description - Generate a patch file for epubjs that should scroll us to the right spot - Install the patch on postinstall of packages - Validate that epubjs now scrolls to the correct location. ## How have you tested this? *Unfortunately*, I have not been able to test on ABS itself. I need some help in doing that. I built a quick web app with epubjs and validated this behavior both pre- and post-patch. ## Screenshots <!-- If your PR includes any changes to the web client, please include screenshots or a short video from before and after your changes. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:07 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4282