Skip to content

Commit

Permalink
Rever reset-scroll-X (#27423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Voytenko committed Mar 26, 2020
1 parent d328abc commit 6e712d9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
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 @@ -241,18 +241,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

0 comments on commit 6e712d9

Please sign in to comment.