Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: scroll beyond numpages

Marc Seitz779151f7b31b
diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsx
index cf144798..b6b344a3 100644
--- a/components/view/PagesViewerNew.tsx
+++ b/components/view/PagesViewerNew.tsx
@@ -431,8 +431,7 @@ export default function PagesViewer({
if (isVertical) {
scrollActionRef.current = true;
const newScrollPosition =
- ((pageNumber - 2) * containerRef.current!.scrollHeight) /
- numPagesWithAccountCreation;
+ (pageNumber - 2) * containerRef.current!.clientHeight;
containerRef.current?.scrollTo({
top: newScrollPosition,
behavior: "smooth",
@@ -478,8 +477,7 @@ export default function PagesViewer({
if (isVertical) {
scrollActionRef.current = true;
const newScrollPosition =
- (pageNumber * containerRef.current!.scrollHeight) /
- numPagesWithAccountCreation;
+ pageNumber * containerRef.current!.clientHeight;
containerRef.current?.scrollTo({
top: newScrollPosition,
behavior: "smooth",