From f536b3969dd1d6225304af31013c1c7d1321da6a Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Thu, 4 Jan 2018 10:17:03 +0530 Subject: [PATCH] Prevent page scroll to top while clicking on language settings icon If the language settings window is not visible, all calculations will go wrong and page will scroll to 0 position. So call scrollIntoView only when the element is visible. The $.fn.scrollIntoView defined in jquery.uls core may be unnecessary now since it is available natively on DOM elements. Bug: T178188 Change-Id: I461fa9eb7c51cd277bebd3a04cfcc0eed9793c4e --- resources/js/ext.uls.languagesettings.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/js/ext.uls.languagesettings.js b/resources/js/ext.uls.languagesettings.js index e39f3a64..b806d193 100644 --- a/resources/js/ext.uls.languagesettings.js +++ b/resources/js/ext.uls.languagesettings.js @@ -149,7 +149,9 @@ var $this = $( this ); $this.data( 'module' ).render(); - languageSettings.$window.scrollIntoView(); + if ( languageSettings.$window.is( ':visible' ) ) { + languageSettings.$window.scrollIntoView(); + } $settingsMenuItems.find( '.menu-section' ).removeClass( 'active' ); $this.addClass( 'active' ); } );