Quellcode durchsuchen

fix scrolling logic

Yuki Takei vor 2 Jahren
Ursprung
Commit
55b2c1ea86
1 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 2 1
      apps/app/src/components/SearchPage/SearchResultContent.tsx

+ 2 - 1
apps/app/src/components/SearchPage/SearchResultContent.tsx

@@ -77,7 +77,8 @@ const scrollToFirstHighlightedKeyword = (scrollElement: HTMLElement): void => {
     return;
   }
 
-  animateScroll.scrollTo(toElem.offsetTop - SCROLL_OFFSET_TOP, {
+  const distance = toElem.getBoundingClientRect().top - scrollElement.getBoundingClientRect().top - SCROLL_OFFSET_TOP;
+  animateScroll.scrollMore(distance, {
     containerId: scrollElement.id,
     duration: 200,
   });