Skip to content

NOREF: Fix PDF scrolling and programmatic navigation bugs#197

Merged
jackiequach merged 2 commits intomainfrom
NOREF/fix-5.0-release-issues
Mar 3, 2026
Merged

NOREF: Fix PDF scrolling and programmatic navigation bugs#197
jackiequach merged 2 commits intomainfrom
NOREF/fix-5.0-release-issues

Conversation

@jackiequach
Copy link
Collaborator

@jackiequach jackiequach commented Mar 3, 2026

  • Fixes issue when navigating with the arrows will scroll the page to the top of the reader
    • Updated to scroll only within the reader component
  • Fixes an issue where the default height of the reader is not set to the height of the browser
  • Minor optimizations to onInView to ignore off-screen pages. Adds a programmatic navigation delay that prevents goForward, goBackward, and goToPage from triggering onInView, which sometimes caused the reader to jump pages if multiple pages were visible at once.

@vercel
Copy link

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web-reader Ready Ready Preview, Comment Mar 3, 2026 6:21pm

Request Review

@jackiequach jackiequach marked this pull request as ready for review March 3, 2026 15:28
@jackiequach jackiequach requested a review from alea12 as a code owner March 3, 2026 15:28
Comment on lines +243 to +248
const scrollState = React.useRef({
ratios: new Map<number, number>(),
lastVisiblePage: state.pageNumber,
isInViewUpdate: false,
lastProgrammaticNavAt: 0,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move scrollState declaration above the useEffect that references it since useRef calls aren't hoisted? Or was this ordering intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it up.

@jackiequach jackiequach merged commit 34a11a8 into main Mar 3, 2026
7 checks passed
@jackiequach jackiequach deleted the NOREF/fix-5.0-release-issues branch March 3, 2026 19:33
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.

2 participants