mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Delay scrollToHeading() until after the selection is rerendered
Otherwise either the focusing of the surface or the resetting of the selection seems to cause the viewport to scroll back up on mobile. Change-Id: Ie3b104e04800d2753f99739f877c76e334965fc1
This commit is contained in:
parent
7072345c22
commit
859d85257b
|
@ -1434,6 +1434,7 @@ ve.init.mw.Target.prototype.startSanityCheck = function () {
|
|||
ve.init.mw.Target.prototype.restoreEditSection = function () {
|
||||
if ( this.section !== undefined && this.section > 0 ) {
|
||||
var offset, offsetNode, nextNode,
|
||||
target = this,
|
||||
surfaceView = this.surface.getView(),
|
||||
surfaceModel = surfaceView.getModel(),
|
||||
$documentNode = surfaceView.getDocument().getDocumentNode().$element,
|
||||
|
@ -1465,9 +1466,8 @@ ve.init.mw.Target.prototype.restoreEditSection = function () {
|
|||
// the model selection, otherwise it will get reset
|
||||
this.surface.getView().once( 'focus', function () {
|
||||
surfaceModel.setSelection( new ve.Range( offset ) );
|
||||
target.scrollToHeading( headingNode );
|
||||
} );
|
||||
// Scroll to heading:
|
||||
this.scrollToHeading( headingNode );
|
||||
}
|
||||
|
||||
this.section = undefined;
|
||||
|
|
Loading…
Reference in a new issue