When clicking a region, scroll only the list and not the whole page
Downstream bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=59175
This commit is contained in:
@@ -144,16 +144,19 @@
|
||||
},
|
||||
|
||||
click: function () {
|
||||
var $list, $firstTargetRegion;
|
||||
|
||||
// Don't do anything if a region is selected already
|
||||
if ( this.$element.hasClass( 'active' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$list = this.options.$target.$element;
|
||||
$firstTargetRegion = $list.find( '#' + this.regions[0] );
|
||||
|
||||
// Scroll to appropriate area
|
||||
this.options.$target.$element
|
||||
.find( '#' + this.regions[0] )
|
||||
.get( 0 )
|
||||
.scrollIntoView( true, { behavior: 'smooth' } );
|
||||
$list.scrollTop( 0 );
|
||||
$list.scrollTop( $firstTargetRegion.offset().top - $list.offset().top );
|
||||
|
||||
// Make the selected region (and it only) active
|
||||
$( '.regionselector' ).removeClass( 'active' );
|
||||
|
||||
Reference in New Issue
Block a user