mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
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:
parent
54a576e6d3
commit
64c7859c9f
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue