I have a button at the bottom of a page that scrolls to some element on the top when tapped. It looks like this:
<a class="btn btn-orange" on="tap:
top-section.scrollTo(duration=400),
buysell-location.focus,
AMP.setState({buysellForm: {query: ''}})">Find an Agent</a>
This used to work perfectly fine until recently. After some recent changes in AMP the smooth scrolling part doesn't work anymore, and instead when tapping this button it immediately jumps to the target element and scrolls to its position from the top side.
This issue can be observed on the following page:
https://www.upnest.com/
Click on "Find an Agent" at the bottom.
Chrome, Firefox, maybe others.
This is a new issue. AMP version is 1534366245210.
So it seems that originally a chain of actions would run one by one based on if the previous action's promise is resolved. However, for that global action scrollTo
, it seems that its handler simply returns null
instead of returning the animation promise. Will check if changing this behavior could fix the issue.
Thanks @kevinkassimo
Thank you, I can confirm that it works
Most helpful comment
So it seems that originally a chain of actions would run one by one based on if the previous action's promise is resolved. However, for that global action
scrollTo
, it seems that its handler simply returnsnull
instead of returning the animation promise. Will check if changing this behavior could fix the issue.