Sticky ad: wait for fixed layer to complete before loading an ad#9171
Merged
dvoytenko merged 2 commits intoampproject:masterfrom May 5, 2017
Merged
Sticky ad: wait for fixed layer to complete before loading an ad#9171dvoytenko merged 2 commits intoampproject:masterfrom
dvoytenko merged 2 commits intoampproject:masterfrom
Conversation
zhouyx
approved these changes
May 5, 2017
| onScroll_() { | ||
| if (isExperimentOn(this.win, EARLY_LOAD_EXPERIMENT)) { | ||
| const scrollTop = this.viewport_.getScrollTop(); | ||
| if (isExperimentOn(this.win, EARLY_LOAD_EXPERIMENT) && scrollTop > 1) { |
Contributor
There was a problem hiding this comment.
I don't think there's need to check scrollTop here
Contributor
Author
There was a problem hiding this comment.
The problem is that iOS often offsets to 1 to avoid scroll freeze issue. See https://github.com/ampproject/amphtml/blob/master/src/service/viewport-impl.js#L1478
| this.viewport_.addToFixedLayer(this.element); | ||
| this.addCloseButton_(); | ||
| this.scheduleLayoutForAd_(); | ||
| this.viewport_.addToFixedLayer( |
Contributor
There was a problem hiding this comment.
Is the promise always promised to resolve?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial for #8780.
What likely was happening here is that the ad's iframe was reloaded by browser when the ad was transferred to the fixed layer. Browsers always reset/reload iframe's window when reparented, so this is somewhat likely.
/cc @keithwrightbos