From a6aa6daa28edc51f3f050a035f997875beb62c38 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 19 Apr 2016 21:42:09 +0100 Subject: [PATCH] Defer before restoring scroll position, and allow 0 Bug: T131791 Change-Id: Id48b913effe5313c193ce62b19faf5655278ff6d --- .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index c3a1a53b45..67e085b50a 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -662,7 +662,11 @@ ve.init.mw.DesktopArticleTarget.prototype.surfaceReady = function () { // Update UI this.changeDocumentTitle(); - this.restoreScrollPosition(); + // Support: IE<=11 + // IE requires us to defer before restoring the scroll position + setTimeout( function () { + target.restoreScrollPosition(); + } ); // Parent method ve.init.mw.DesktopArticleTarget.super.prototype.surfaceReady.apply( this, arguments ); @@ -1037,7 +1041,7 @@ ve.init.mw.DesktopArticleTarget.prototype.saveScrollPosition = function () { * Restore the window's scroll position. */ ve.init.mw.DesktopArticleTarget.prototype.restoreScrollPosition = function () { - if ( this.scrollTop ) { + if ( this.scrollTop !== null ) { $( window ).scrollTop( this.scrollTop ); this.scrollTop = null; }