From ecc649e23b63f4c12fcc4a9fd24568b11b985dad Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 2 Oct 2024 08:11:39 -0600 Subject: [PATCH] Use content height --- web/src/views/events/EventView.tsx | 10 ++++++++-- web/src/views/search/SearchView.tsx | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web/src/views/events/EventView.tsx b/web/src/views/events/EventView.tsx index 673ee624d..6d2d99fe6 100644 --- a/web/src/views/events/EventView.tsx +++ b/web/src/views/events/EventView.tsx @@ -634,10 +634,16 @@ function DetectionReview({ } break; case "PageDown": - contentRef.current?.scrollBy({ top: 600, behavior: "smooth" }); + contentRef.current?.scrollBy({ + top: contentRef.current.clientHeight / 2, + behavior: "smooth", + }); break; case "PageUp": - contentRef.current?.scrollBy({ top: -600, behavior: "smooth" }); + contentRef.current?.scrollBy({ + top: -contentRef.current.clientHeight / 2, + behavior: "smooth", + }); break; } }); diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index e586c8846..7e77c20b8 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -241,10 +241,16 @@ export default function SearchView({ }); break; case "PageDown": - contentRef.current?.scrollBy({ top: 600, behavior: "smooth" }); + contentRef.current?.scrollBy({ + top: contentRef.current.clientHeight / 2, + behavior: "smooth", + }); break; case "PageUp": - contentRef.current?.scrollBy({ top: -600, behavior: "smooth" }); + contentRef.current?.scrollBy({ + top: -contentRef.current.clientHeight / 2, + behavior: "smooth", + }); break; } },