-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Attach (recommended) or Link to PDF file
bad match scrolling & stepping.pdf
Web browser and its version
Chrome 129, Firefox 130
Operating system and its version
WIndows 11
PDF.js version
4.6.82
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
- Open the problem document in demo viewer
- Initiate a "Find in Document" for "Page1"
What is the expected behavior?
The highlighted match on page 1 should be scrolled into view (if not already).
What went wrong?
The document scrolls to show the middle of page 2 at the top, with the highlighted match out of view.
Link to a viewer
No response
Additional context
I came across a problematic document where the "Find in Document" feature was always scrolling a page or more past the highlighted match. I was able to create this sample document by editing / scrubbing the original document using Acrobat.
Notice that with this sample document, searches for "Page1", "Page2", "Page3", always scroll to middle of the next page. Searches for "Page4" and "Page5" would likely behave similarly, except we reach the max scroll at the end of the document.
This document also exhibits strange "next" / "previous" find behavior, which may be related to the same scroll offset issue. Initiating a search for just "Page" correctly identifies 5 matches, but cycling forward goes from "1 of 5" to "3 of 5" to "5 of 5", and skips "2 of 5" and "4 of 5". Cycling backwards goes from "5 of 5" to "4 of 5" to "3 of 5" and then back to "5 of 5", skipping "2 of 5" and "1 of 5".