Custom scrolling method with touchAction works partially

Hi, I created a custom scrolling method which scroll into a view of an element.
when I am using it in my app it works on certain conditions.
I have a form with a lot of popups which opens scrollable list views.
when I am using my method to scroll on them it works perfectly.
meanwhile, when I try to use the same method on the regular screen(full window size) it doesn’t work unless I change something which I will list later.

the method:

this is the method.
the main problem is the marked line. I add a wait after the moveTo because I don’t want it to scroll all the way to the bottom of the screen. it works great in those scrollable popups…
but when I try the method on a full screen it does not work unless I delete this line and then it will scroll all the way down…

my question is just why?.. and how can I fix it so it will work in partial(popups) and full screen without scroll all the way down?

thanks for everyone!