// Parent
mw.rcfilters.ui.FilterCapsuleMultiselectWidget.parent.call( this, $.extend( true, {
- popup: { $autoCloseIgnore: filterInput.$element.add( this.$overlay ) }
+ popup: {
+ $autoCloseIgnore: filterInput.$element.add( this.$overlay ),
+ $floatableContainer: filterInput.$element
+ }
}, config ) );
this.controller = controller;
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
*/
this.resetButton.setLabel(
currFiltersAreEmpty ? mw.msg( 'rcfilters-restore-default-filters' ) : ''
);
+ this.resetButton.setTitle(
+ currFiltersAreEmpty ? null : mw.msg( 'rcfilters-clear-all-filters' )
+ );
this.resetButton.toggle( !hideResetButton );
this.emptyFilterMessage.toggle( currFiltersAreEmpty );