Merge "RCFilters UI: Prevent the popup from disappearing when input is out of view"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 8 Mar 2017 01:37:08 +0000 (01:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 8 Mar 2017 01:37:08 +0000 (01:37 +0000)
1  2 
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterWrapperWidget.js

@@@ -56,7 -56,8 +56,8 @@@
                                $content: this.filterPopup.$element,
                                $footer: $footer,
                                classes: [ 'mw-rcfilters-ui-filterWrapperWidget-popup' ],
-                               width: 650
+                               width: 650,
+                               hideWhenOutOfView: false
                        }
                } );
  
@@@ -75,6 -76,7 +76,6 @@@
                // Initialize
                this.$element
                        .addClass( 'mw-rcfilters-ui-filterWrapperWidget' )
 -                      .addClass( 'mw-rcfilters-ui-ready' )
                        .append( this.capsule.$element, this.textInput.$element );
        };
  
         */
        mw.rcfilters.ui.FilterWrapperWidget.prototype.scrollToTop = function ( $element, marginFromTop ) {
                var container = OO.ui.Element.static.getClosestScrollableContainer( $element[ 0 ], 'y' ),
 -                      pos = OO.ui.Element.static.getRelativePosition( $element, $( container ) );
 +                      pos = OO.ui.Element.static.getRelativePosition( $element, $( container ) ),
 +                      containerScrollTop = $( container ).is( 'body, html' ) ? 0 : $( container ).scrollTop();
  
                // Scroll to item
                $( container ).animate( {
 -                      scrollTop: $( container ).scrollTop() + pos.top + ( marginFromTop || 0 )
 +                      scrollTop: containerScrollTop + pos.top - ( marginFromTop || 0 )
                } );
        };
  }( mediaWiki ) );