diff --git a/components/lib/inputtextarea/InputTextarea.js b/components/lib/inputtextarea/InputTextarea.js index f0b502f6a6..9ba69f9cae 100644 --- a/components/lib/inputtextarea/InputTextarea.js +++ b/components/lib/inputtextarea/InputTextarea.js @@ -89,7 +89,7 @@ export const InputTextarea = React.memo( const resize = (initial) => { const inputEl = elementRef.current; - if (inputEl && DomHandler.isVisible(inputEl)) { + if (inputEl && isVisible(inputEl)) { if (!cachedScrollHeight.current) { cachedScrollHeight.current = inputEl.scrollHeight; inputEl.style.overflow = 'hidden'; @@ -111,6 +111,16 @@ export const InputTextarea = React.memo( } }; + const isVisible = () => { + if (DomHandler.isVisible(elementRef.current)) { + const rect = elementRef.current.getBoundingClientRect(); + + return rect.width > 0 && rect.height > 0; + } + + return false; + }; + React.useEffect(() => { ObjectUtils.combinedRefs(elementRef, ref); }, [elementRef, ref]);