As far as I know, the problem is that when the keyboard starts, the browser tries to move the window into the field of view of the element itself.
What can happen is that the position of the scrollbar is recorded before the keyboard appears. The browser then calculates the distance that needs to be moved to the window in order to bring the item into view as soon as the keyboard pops up, based on the recorded value. After that, you changed the position of the window. Thus, it moves the window relative to the position you are setting, as opposed to the position in which it is thinking.
What behavior do you experience if you are not trying to scroll an element in the view manually (without creating scripts)?
It seems to me that the iPhone browser initially does what you want. If not, this may have something to do with positioning the elements. I.E. The browser cannot correctly calculate the position of an element, for example. If it is in a container with a fixed position (because it will move as soon as the browser tries to execute scollTo).
If this fails, try putting the scrollTo function in a timeout so that it works after the keyboard appears.
source share