RCFilters: Scroll widget to top when switching view
authorMoriel Schottlender <moriel@gmail.com>
Tue, 1 Aug 2017 21:49:23 +0000 (14:49 -0700)
committerMoriel Schottlender <moriel@gmail.com>
Tue, 1 Aug 2017 21:49:23 +0000 (14:49 -0700)
Bug: T170651
Change-Id: I19865b0af73e88c2893ba688476aa505d7730947

resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterTagMultiselectWidget.js

index 934c7c4..530429e 100644 (file)
@@ -29,6 +29,7 @@
                this.queriesModel = savedQueriesModel;
                this.$overlay = config.$overlay || this.$element;
                this.matchingQuery = null;
+               this.currentView = this.model.getCurrentView();
 
                // Parent
                mw.rcfilters.ui.FilterTagMultiselectWidget.parent.call( this, $.extend( true, {
 
                // Update input
                this.input.setValue( inputValue );
+
+               if ( this.currentView !== view ) {
+                       this.scrollToTop( this.$element );
+                       this.currentView = view;
+               }
        };
 
        /**