scrollTo() does not work while page is scrolling
If scrollTo() is called while page is scrolling (e.g. continuation of a momentum scroll), it does nothing.
Not a big deal but somewhat annoying. related: #16860
From what I can tell, this is not a problem for desktop browsers. I tested manually on macOS on Chrome, Opera, Firefox, and Safari and experienced that scrollTo worked even while momentum scrolling was active.
I did experience the problem using Chrome on both Android and iOS devices, and I believe the underlaying cause is the following. When scrollTo is assigned to the tap event, i.e. on="element-id.scrollTo(), the tap event is not registered while inertial scrolling is occurring. From the point of view of the mobile operating systems, this is working as intended. When inertial scrolling, a user tap is not intentionally interacting with the webpage but rather to stop the inertial scrolling. An unintended side effect of stopping inertial scrolling with a tap would be to click on an underlaying web element and be navigated to a different page, or in our case, to be scrolled to the top.
Knowing this, is this still something we want to change? A common way to solve this is to set a small timeout when calling scrollTo, but I'm not sure what support we have to do that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
@ampproject/wg-components Anyone interested in investigating?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.