Scroll the textbox to selection (error location) on page load

Only doing 'setSelection' doesn't guarantee that the textbox will be
scrolled (it works on Firefox and Edge, but not on Chrome and IE).

Bug: T152760
Change-Id: I3fab6363cd432d137430884eaca3555a7bf5aafa
This commit is contained in:
Bartosz Dziewoński 2019-06-09 12:44:27 +02:00
parent 86620b72be
commit d18262cfa1

View file

@ -6,6 +6,7 @@ $( function () {
if ( location ) {
if ( $textbox.length ) {
$textbox.trigger( 'focus' ).textSelection( 'setSelection', { start: location[ 0 ], end: location[ 1 ] } );
$textbox.textSelection( 'scrollToCaretPosition' );
}
mw.hook( 've.tempWikitextReady' ).add( function () {
mw.libs.ve.tempWikitextEditor.$element[ 0 ].setSelectionRange(