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 ) { if ( !soft ) {
this.focus(); 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 ) { ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.setPage = function ( name ) {
var page = this.pages[ name ]; var page = this.pages[ name ];
if ( page ) { if ( page && name === this.currentPageName ) {
page.scrollElementIntoView( { alignToTop: true, padding: { top: 20 } } ); return;
if ( name === this.currentPageName ) {
return;
}
} }
var previousPage = this.currentPageName ? this.pages[ this.currentPageName ] : null; var previousPage = this.currentPageName ? this.pages[ this.currentPageName ] : null;