diff --git a/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js index 75bc6ae3fa..cb34c80d41 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.MobileArticleTarget.js @@ -266,6 +266,10 @@ ve.init.mw.MobileArticleTarget.prototype.surfaceReady = function () { return; } + // Calls scrollSelectionIntoView so must be called before parent, + // which calls goToHeading. (T225292) + this.adjustContentPadding(); + // Parent method ve.init.mw.MobileArticleTarget.super.prototype.surfaceReady.apply( this, arguments ); @@ -281,7 +285,6 @@ ve.init.mw.MobileArticleTarget.prototype.surfaceReady = function () { this.overlay.hideSpinner(); surface.getContext().connect( this, { resize: 'adjustContentPaddingDebounced' } ); - this.adjustContentPadding(); this.maybeShowWelcomeDialog(); }; diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 130a3e0150..0f86bdbc9e 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -517,7 +517,6 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () { surfaceModel.connect( this, { history: 'updateToolbarSaveButtonState' } ); - this.restoreEditSection(); // Iterate over the trigger registry and resolve any access key conflicts for ( name in ve.ui.triggerRegistry.registry ) { @@ -545,6 +544,10 @@ ve.init.mw.ArticleTarget.prototype.surfaceReady = function () { // Parent method ve.init.mw.ArticleTarget.super.prototype.surfaceReady.apply( this, arguments ); + // Do this after window is made scrollable on mobile + // ('surfaceReady' handler in VisualEditorOverlay in MobileFrontend) + this.restoreEditSection(); + mw.hook( 've.activationComplete' ).fire(); };