Answer the question
In order to leave comments, you need to log in
Ref scrollTop = scrollHeight why is scrollTop not equal to scrollHeight?
Dear, I'm trying to scroll the block to the very bottom after loading the data.
I use useRef and this construction
ref.current.scrollTop = ref.current.scrollHeight;
The block is scrolled, but not to the end
Values are:
scrollHeihgt:
When mounting - 444
After receiving data - 1884
scrollTop:
After assigning - 1440
from here I see that for some reason scrollHeight is minus clientHeight
What's the trouble?
Answer the question
In order to leave comments, you need to log in
So what's the trouble?
Can't scroll past block boundaries, so scrollTop is cast to the nearest valid value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question