Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-carousel: Tapping arrow buttons triggers slideChange action twice #9835

Closed
dreamofabear opened this issue Jun 9, 2017 · 5 comments
Closed
Assignees
Labels

Comments

@dreamofabear
Copy link

dreamofabear commented Jun 9, 2017

This can cause unexpected behavior for non-idempotent actions triggered by slideChange.

slidescroll#customSnap_ is called twice:

  • At animation start in go
  • When animation completes in scrollHandler_

/cc @camelburrito

@camelburrito
Copy link
Contributor

This is expected . Go happens via button click so we custom snap from the beginning.

In scrollhandler we monitor scroll and decide when to start snapping (custom snap is needed here too)

@dreamofabear
Copy link
Author

Thanks for the context.

@camelburrito
Copy link
Contributor

Can we close this or is there something else that we need to discuss?

@dreamofabear
Copy link
Author

No, this is definitely a bug since slideChange should not be triggered twice. Need to add guards or change the implementation.

@camelburrito
Copy link
Contributor

camelburrito commented Jun 10, 2017

ooops - i did not see the slidechange event being triggered.

https://github.com/ampproject/amphtml/blob/master/extensions/amp-carousel/0.1/slidescroll.js#L584

this.slideChange_ will not do anything if it is already snapping at the slideindex , this is also how we do analytics for the slides, i deally the event should be triggered exactly where the analytics gets triggered.

https://github.com/ampproject/amphtml/blob/master/extensions/amp-carousel/0.1/slidescroll.js#L572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants