ve.ui.MWTemplateDialog: Prevent scrolling to top after removing a parameter

Bug: T180151
Change-Id: I063c53fa572e998f5b34fc895d02fe1a74026c6e
This commit is contained in:
Bartosz Dziewoński 2018-06-21 20:45:06 +02:00
parent bbc55bcdba
commit b51707d96f

View file

@ -235,12 +235,15 @@ ve.ui.MWTemplateDialog.prototype.onRemoveParameter = function ( param ) {
var page = this.bookletLayout.getPage( param.getId() ),
reselect = this.bookletLayout.findClosestPage( page );
this.bookletLayout.removePages( [ page ] );
if ( this.loaded ) {
if ( !this.preventReselection ) {
this.setPageByName( reselect.getName() );
}
// Select the desired page first. Otherwise, if the page we are removing is selected,
// OOUI will try to select the first page after it is removed, and scroll to the top.
if ( this.loaded && !this.preventReselection ) {
this.setPageByName( reselect.getName() );
}
this.bookletLayout.removePages( [ page ] );
if ( this.loaded ) {
this.altered = true;
this.setApplicableStatus();
}