UI moves when I put a ref in a Box/div

37 views Asked by At

I have the following code:

enter image description here

and it looks like this:

enter image description here

I need to add a div with a reference inside it:

enter image description here

And if I do so, all the UI moves up. See this picture:

enter image description here

I realized this happens only when I add the ref attribute to the div. Can anyone help me understand why this is happening?

1

There are 1 answers

0
Darshan Patel On BEST ANSWER

you can do that easily by using scrollTop property, find scrollable element and set scrollTop to 0, document.getElementById('#eampleScrollableDiv').scrollTop = 0