Skip to content

Commit

Permalink
Fixed #7517 - The InputTextarea component with the autoResize propert…
Browse files Browse the repository at this point in the history
…y shrinks within the TabView when renderActiveOnly={false} is set.
  • Loading branch information
mertsincan committed Dec 20, 2024
1 parent f089480 commit 9e5670a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/lib/inputtextarea/InputTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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]);
Expand Down

0 comments on commit 9e5670a

Please sign in to comment.