From d57210c1c0ca07399788841721cad1a943087f25 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Fri, 15 Jul 2022 14:16:34 +0200 Subject: [PATCH] Rename misleading templateParameterSelectionChanged event This is not only fired when a parameter is checked or unchecked. It's also not only fired when another parameter in the parameter SelectWidget is selected. It's always fired just because the spacebar is pressed. This is so we can scroll that parameter into view. Change-Id: Id621405b7ca3116cd4a06f474e49776d0830dccc --- .../ve.ui.MWTransclusionOutlineParameterSelectWidget.js | 8 ++++---- .../widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.js index 880fcd218e..9475a15097 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineParameterSelectWidget.js @@ -46,9 +46,9 @@ OO.mixinClass( ve.ui.MWTransclusionOutlineParameterSelectWidget, ve.ui.MWAriaDes /** * This is fired instead of the "choose" event from the {@see OO.ui.SelectWidget} base class when - * pressing space on a parameter to toggle it, without loosing the focus. + * pressing space on a parameter to toggle it or scroll it into view, without losing the focus. * - * @event templateParameterSelectionChanged + * @event templateParameterSpaceDown * @param {ve.ui.MWTransclusionOutlineParameterWidget} item * @param {boolean} selected */ @@ -196,7 +196,7 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onMouseDown = functio * @inheritDoc OO.ui.SelectWidget * @param {KeyboardEvent} e * @fires choose - * @fires templateParameterSelectionChanged + * @fires templateParameterSpaceDown */ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onDocumentKeyDown = function ( e ) { var item; @@ -224,7 +224,7 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.onDocumentKeyDown = f } else { this.selectItem( item ); } - this.emit( 'templateParameterSelectionChanged', item, item.isSelected() ); + this.emit( 'templateParameterSpaceDown', item, item.isSelected() ); } e.preventDefault(); break; diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js index 7fa04d3a1a..4bf2c584ed 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js @@ -103,7 +103,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.initializeParameterList = fu $ariaDescribedBy: $parametersAriaDescription } ).connect( this, { choose: 'onTemplateParameterChoose', - templateParameterSelectionChanged: 'onTemplateParameterSelectionChanged', + templateParameterSpaceDown: 'onTemplateParameterSpaceDown', change: 'onParameterWidgetListChanged' } ); @@ -299,7 +299,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onTemplateParameterChoose = * @param {OO.ui.OptionWidget} item * @param {boolean} selected */ -ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onTemplateParameterSelectionChanged = function ( item, selected ) { +ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onTemplateParameterSpaceDown = function ( item, selected ) { this.toggleParameter( item, selected, true ); };