소스 검색

Merge pull request #16706 from overleaf/ii-review-panel-refresh-entry-positions-on-resize

[web] Reposition review panel entries correctly on resize

GitOrigin-RevId: 04f94c20393b1da318560d39175c2b860738998b
ilkin-overleaf 2 년 전
부모
커밋
55fcf8a0ee
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      services/web/frontend/js/shared/components/auto-expanding-text-area.tsx

+ 4 - 2
services/web/frontend/js/shared/components/auto-expanding-text-area.tsx

@@ -74,12 +74,14 @@ function AutoExpandingTextArea({
     }
 
     const resizeObserver = new ResizeObserver(() => {
-      // Ignore the resize that is triggered when the element is first
-      // inserted into the DOM
       if (!ref.current) {
         return
       }
       const newHeight = ref.current.offsetHeight
+      // Ignore the resize when the height of the element is less than or equal to 0
+      if (newHeight <= 0) {
+        return
+      }
       const heightChanged = newHeight !== previousHeightRef.current
       previousHeightRef.current = newHeight
       if (heightChanged) {