From 64c7859c9fbd5785a4a5210ffc77177911853c14 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Thu, 23 Sep 2021 13:12:50 +0200 Subject: [PATCH] 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 --- .../ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js index ace4740140..7cc1cab979 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js @@ -152,6 +152,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.addPartWidget = function ( */ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = function ( pageName ) { var partId = pageName.split( '/', 1 )[ 0 ], + isParameterId = pageName.length > partId.length, changed = false; for ( var id in this.partWidgets ) { @@ -160,7 +161,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = func if ( partWidget.isSelected() !== selected ) { partWidget.setSelected( selected ); - if ( selected ) { + if ( selected && !isParameterId ) { partWidget.scrollElementIntoView(); } changed = true; @@ -168,7 +169,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.selectPartByPageName = func if ( selected && partWidget instanceof ve.ui.MWTransclusionOutlineTemplateWidget && - pageName.length > partId.length + isParameterId ) { var paramName = pageName.slice( partId.length + 1 ); partWidget.highlightParameter( paramName );