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

Rever reset-scroll-X #27423

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/service/viewport/viewport-binding-natural.js
Expand Up @@ -56,12 +56,6 @@ export class ViewportBindingNatural_ {
/** @private @const {!Observable} */
this.resizeObservable_ = new Observable();

/**
* See `handleScrollEvent_` for details.
* @private @const {boolean}
*/
this.resetScrollX_ = this.platform_.isIos() && this.win.parent !== this.win;

/** @const {function()} */
this.boundScrollEventListener_ = this.handleScrollEvent_.bind(this);

Expand All @@ -74,16 +68,6 @@ export class ViewportBindingNatural_ {

/** @private */
handleScrollEvent_() {
if (
this.resetScrollX_ &&
this.getScrollingElement()./*OK*/ scrollLeft > 0
) {
// In the iframed iOS Safari case the `touch-action` and
// `overscroll-behavior` are not observed which leads to the overscroll
// bugs on the horizontal axis. The solution is to reset the horizontal
// scrolling in this case. See b/140131460 for more details.
this.getScrollingElement()./*OK*/ scrollLeft = 0;
}
this.scrollObservable_.fire();
}

Expand Down
12 changes: 0 additions & 12 deletions test/unit/test-viewport-binding.js
Expand Up @@ -251,18 +251,6 @@ describes.realWin('ViewportBindingNatural on iOS', {ampCss: true}, env => {
binding = new ViewportBindingNatural_(ampdoc);
binding.connect();
});

it('should reset overscroll on X-axis', () => {
win.scrollTo(1, 0);
expect(win.pageXOffset).to.equal(1);
return new Promise(resolve => {
win.addEventListener('scroll', () => {
if (win.pageXOffset == 0) {
resolve();
}
});
});
});
});

describes.realWin('ViewportBindingIosEmbedWrapper', {ampCss: true}, env => {
Expand Down