diff --git a/packages/react-core/src/components/TextArea/TextArea.tsx b/packages/react-core/src/components/TextArea/TextArea.tsx index 267e67728af..cc52d94e76c 100644 --- a/packages/react-core/src/components/TextArea/TextArea.tsx +++ b/packages/react-core/src/components/TextArea/TextArea.tsx @@ -62,13 +62,15 @@ class TextAreaBase extends Component { const parent = field.parentElement; parent.style.setProperty('height', 'inherit'); const computed = window.getComputedStyle(field); + const parentComputed = window.getComputedStyle(parent); // Calculate the height const height = parseInt(computed.getPropertyValue('border-top-width')) + - parseInt(computed.getPropertyValue('padding-top')) + field.scrollHeight + - parseInt(computed.getPropertyValue('padding-bottom')) + - parseInt(computed.getPropertyValue('border-bottom-width')); + parseInt(computed.getPropertyValue('border-bottom-width')) + + parseInt(parentComputed.getPropertyValue('padding-top')) + + parseInt(parentComputed.getPropertyValue('padding-bottom')); + parent.style.setProperty('height', `${height}px`); }; diff --git a/packages/react-core/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap b/packages/react-core/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap index 3ec7f3e5991..668f16aee72 100644 --- a/packages/react-core/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +++ b/packages/react-core/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap @@ -4,7 +4,7 @@ exports[`Matches the snapshot 1`] = `