Actually, the problem was that `scrollHeight` was "0" at the time of reading. I moved the setter inside the click handler, resulting in the expected behaviour: The height is correctly adjusted.