فهرست منبع

Merge pull request #7943 from weseek/fix/auto-scroll-search-result-content-2

fix: Auto-scroll search result content 2
Yuki Takei 2 سال پیش
والد
کامیت
4d6771d768
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  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,
   });