Amphtml: scrollTo is not scrolling smoothly when called together with focus

Created on 16 Aug 2018  路  3Comments  路  Source: ampproject/amphtml

What's the issue?

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.

How do we reproduce the issue?

This issue can be observed on the following page:

https://www.upnest.com/
Click on "Find an Agent" at the bottom.

What browsers are affected?

Chrome, Firefox, maybe others.

Which AMP version is affected?

This is a new issue. AMP version is 1534366245210.

Bug

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 returns null instead of returning the animation promise. Will check if changing this behavior could fix the issue.

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aghassemi picture aghassemi  路  3Comments

radiovisual picture radiovisual  路  3Comments

aghassemi picture aghassemi  路  3Comments

gmajoulet picture gmajoulet  路  3Comments

jpettitt picture jpettitt  路  3Comments