Prevent scrolling sidebar to heading of subitem

Scroll was landing in the wrong place.  Subitem should be kept
on-screen after click.

Change-Id: I3c1901b7b53ac523bcc0d33172b674b97421c06d
This commit is contained in:
Adam Wight 2021-09-23 13:12:50 +02:00 committed by Awight
parent 54a576e6d3
commit 64c7859c9f

View file

@ -152,6 +152,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.addPartWidget = function (
*/ */
ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = function ( pageName ) { ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = function ( pageName ) {
var partId = pageName.split( '/', 1 )[ 0 ], var partId = pageName.split( '/', 1 )[ 0 ],
isParameterId = pageName.length > partId.length,
changed = false; changed = false;
for ( var id in this.partWidgets ) { for ( var id in this.partWidgets ) {
@ -160,7 +161,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = func
if ( partWidget.isSelected() !== selected ) { if ( partWidget.isSelected() !== selected ) {
partWidget.setSelected( selected ); partWidget.setSelected( selected );
if ( selected ) { if ( selected && !isParameterId ) {
partWidget.scrollElementIntoView(); partWidget.scrollElementIntoView();
} }
changed = true; changed = true;
@ -168,7 +169,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = func
if ( selected && if ( selected &&
partWidget instanceof ve.ui.MWTransclusionOutlineTemplateWidget && partWidget instanceof ve.ui.MWTransclusionOutlineTemplateWidget &&
pageName.length > partId.length isParameterId
) { ) {
var paramName = pageName.slice( partId.length + 1 ); var paramName = pageName.slice( partId.length + 1 );
partWidget.highlightParameter( paramName ); partWidget.highlightParameter( paramName );