Only move content pane element to top when sidebar element is clicked

This patch contains a small cleanup that moves the scrollIntoView into onSidebarItemSelected.
Since all other places already have a focus call, scrollIntoView is not needed there.

Bug: T312850
Change-Id: I1a3cb3905faea2bd8a6bf8dc4cfd748813e1c875
This commit is contained in:
Svantje Lilienthal 2022-07-12 16:56:50 +02:00
parent fc70c924e5
commit 36d817dfcd

View file

@ -157,6 +157,11 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.onSidebarItemSelected = functi
if ( !soft ) {
this.focus();
}
var page = this.pages[ pageName ];
if ( page ) {
page.scrollElementIntoView( { alignToTop: true, padding: { top: 20 } } );
}
};
/**
@ -345,12 +350,8 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.clearPages = function () {
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.setPage = function ( name ) {
var page = this.pages[ name ];
if ( page ) {
page.scrollElementIntoView( { alignToTop: true, padding: { top: 20 } } );
if ( name === this.currentPageName ) {
return;
}
if ( page && name === this.currentPageName ) {
return;
}
var previousPage = this.currentPageName ? this.pages[ this.currentPageName ] : null;