* @param {boolean} isVisible Menu is visible
*/
FilterTagMultiselectWidget.prototype.onMenuToggle = function ( isVisible ) {
+
+ var scrollToElement = this.isMobile ? this.input.$input : this.$element;
+
// Parent
FilterTagMultiselectWidget.parent.prototype.onMenuToggle.call( this );
}.bind( this )
);
}
+
+ // Only scroll to top of the viewport if:
+ // - The widget is more than 20px from the top
+ // - The widget is not above the top of the viewport (do not scroll downwards)
+ // (This isn't represented because >20 is, anyways and always, bigger than 0)
+ this.scrollToTop( scrollToElement, 0, { min: 20, max: Infinity } );
+
} else {
// Clear selection
this.selectTag( null );
* @inheritdoc
*/
FilterTagMultiselectWidget.prototype.onInputFocus = function () {
- var scrollToElement = this.isMobile ? this.input.$input : this.$element;
// treat the input as a menu toggle rather than a text field on mobile
if ( this.isMobile ) {
// Parent
FilterTagMultiselectWidget.parent.prototype.onInputFocus.call( this );
}
-
- // Only scroll to top of the viewport if:
- // - The widget is more than 20px from the top
- // - The widget is not above the top of the viewport (do not scroll downwards)
- // (This isn't represented because >20 is, anyways and always, bigger than 0)
- this.scrollToTop( scrollToElement, 0, { min: 20, max: Infinity } );
};
/**