putting `textarea.style.height = 'auto';` above actually makes the auto-resize work if the textarea needs to shrink as opposed to grow.