jenkins-bot has submitted this change and it was merged.
Change subject: Focus the surface after VE is already active
......................................................................
Focus the surface after VE is already active
Move the surface focus() call to be done after VE has loaded, to
make sure that the position of the content editable field is at the
top of the page and not -- as happens in Firefox -- after the read
page contents.
Bug: T90420
Change-Id: If91cea42c083d67b1ee6396402c3f607dde70471
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
1 file changed, 10 insertions(+), 3 deletions(-)
Approvals:
Krinkle: Looks good to me, but someone else must approve
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 98f88c0..4aa8136 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -290,6 +290,9 @@
* @return {jQuery.Promise}
*/
ve.init.mw.ViewPageTarget.prototype.activate = function () {
+ var surface,
+ pageTarget = this;
+
if ( !this.active && !this.activating ) {
ve.track( 'trace.activate.enter' );
this.activating = true;
@@ -299,6 +302,10 @@
$( 'html' ).addClass( 've-activating ve-activated' );
$.when( this.activatingDeferred, this.toolbarSetupDeferred
).always( function () {
$( 'html' ).removeClass( 've-activating' ).addClass(
've-active' );
+ // We have to focus the page after hiding the original
content, otherwise
+ // in firefox the contentEditable container was below
the view page, and
+ // 'focus' scrolled the screen down.
+ pageTarget.getSurface().getView().focus();
} );
this.bindHandlers();
@@ -313,7 +320,7 @@
this.saveScrollPosition();
// Create dummy surface to show toolbar while loading
- var surface = this.addSurface( [] );
+ surface = this.addSurface( [] );
surface.disable();
// setSurface creates dummy toolbar
this.setSurface( surface );
@@ -527,15 +534,15 @@
// Update UI
this.changeDocumentTitle();
- this.getSurface().getView().focus();
-
this.setupToolbarSaveButton();
this.attachToolbarSaveButton();
this.restoreScrollPosition();
this.restoreEditSection();
this.setupUnloadHandlers();
this.maybeShowDialogs();
+
this.activatingDeferred.resolve();
+
mw.hook( 've.activationComplete' ).fire();
ve.track( 'trace.activate.exit' );
};
--
To view, visit https://gerrit.wikimedia.org/r/195631
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If91cea42c083d67b1ee6396402c3f607dde70471
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits