Merge "Use HTML::hidden to create input fields"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.FilterItemHighlightButton.js
index 889ba08..7426123 100644 (file)
                this.colorPickerWidget = new mw.rcfilters.ui.HighlightColorPickerWidget( controller, model );
 
                // Parent
-               mw.rcfilters.ui.FilterItemHighlightButton.parent.call( this, $.extend( {}, config, {
+               mw.rcfilters.ui.FilterItemHighlightButton.parent.call( this, $.extend( true, {}, config, {
                        icon: 'highlight',
                        indicator: 'down',
                        popup: {
-                               // TODO: There is a bug in non-anchored popups in
-                               // OOUI, so we set this popup to "anchored" until
-                               // the bug is fixed.
-                               // See: https://phabricator.wikimedia.org/T159906
-                               anchor: true,
+                               anchor: false,
                                padded: true,
                                align: 'backwards',
                                horizontalPosition: 'end',
                // Event
                this.model.connect( this, { update: 'onModelUpdate' } );
                this.colorPickerWidget.connect( this, { chooseColor: 'onChooseColor' } );
+               // This lives inside a MenuOptionWidget, which intercepts mousedown
+               // to select the item. We want to prevent that when we click the highlight
+               // button
+               this.$element.on( 'mousedown', function ( e ) { e.stopPropagation(); } );
 
                this.$element
                        .addClass( 'mw-rcfilters-ui-filterItemHighlightButton' );
 
        OO.inheritClass( mw.rcfilters.ui.FilterItemHighlightButton, OO.ui.PopupButtonWidget );
 
+       /* Static Properties */
+
+       /**
+        * @static
+        */
+       mw.rcfilters.ui.FilterItemHighlightButton.static.cancelButtonMouseDownEvents = true;
+
        /* Methods */
 
        /**