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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix scrollTo with layers #17563

Merged
merged 2 commits into from Aug 24, 2018

Conversation

kevinkassimo
Copy link
Member

With layers, both newScrollTop and curScrollTop should be relative to parent's scrollTop.

Thanks @jridgewell !

newScrollTop = elementRect.top + offset + curScrollTop;
} else {
const calculatedScrollTop = elementRect.top - this.paddingTop_ + offset;
newScrollTop = Math.max(0, calculatedScrollTop);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do this same Math.max for Layers as well. Shouldn't happen in practice, but better to be safe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@cathyxz cathyxz merged commit a2f9c1d into ampproject:master Aug 24, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
* Fix scrollTo with layers

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

Successfully merging this pull request may close these issues.

None yet

4 participants