this.selected = null;
this.resetButton = new OO.ui.ButtonWidget( {
- icon: 'trash',
framed: false,
- title: mw.msg( 'rcfilters-clear-all-filters' ),
classes: [ 'mw-rcfilters-ui-filterCapsuleMultiselectWidget-resetButton' ]
} );
// Events
this.resetButton.connect( this, { click: 'onResetButtonClick' } );
+ this.resetButton.$element.on( 'mousedown', this.onResetButtonMouseDown.bind( this ) );
this.model.connect( this, {
itemUpdate: 'onModelItemUpdate',
highlightChange: 'onModelHighlightChange'
}
};
+ /**
+ * Respond to mouse down event on the reset button to prevent the popup from opening
+ *
+ * @param {jQuery.Event} e Event
+ */
+ mw.rcfilters.ui.FilterCapsuleMultiselectWidget.prototype.onResetButtonMouseDown = function ( e ) {
+ e.stopPropagation();
+ };
+
/**
* Reevaluate the restore state for the widget between setting to defaults and clearing all filters
*/
currFiltersAreEmpty ? mw.msg( 'rcfilters-restore-default-filters' ) : ''
);
this.resetButton.setTitle(
- currFiltersAreEmpty ?
- mw.msg( 'rcfilters-clear-filters-to-defaults' ) :
- mw.msg( 'rcfilters-clear-all-filters' )
+ currFiltersAreEmpty ? null : mw.msg( 'rcfilters-clear-all-filters' )
);
this.resetButton.toggle( !hideResetButton );