diff --git a/frontend/src/lib/autosize.ts b/frontend/src/lib/autosize.ts index cdf560bd80..6a3a9b4107 100644 --- a/frontend/src/lib/autosize.ts +++ b/frontend/src/lib/autosize.ts @@ -17,6 +17,13 @@ export const action = (node) => { const setInitialHeight = () => { let height = 0 + const style = window.getComputedStyle(node) + const visible = style?.getPropertyValue('visibility') === 'hidden' + + if (visible === false) { + return + } + if (node.value) { height = node.scrollHeight } else { @@ -37,7 +44,7 @@ export const action = (node) => { const setHeight = () => { node.style.height = '0px' - node.style.height = Math.max(node.scrollHeight, 40) + 5 + 'px' + node.style.height = Math.max(node.scrollHeight ?? 0, 40) + 5 + 'px' } const addStyles = () => {