Page scrolls when opening language selector

Was happening mostly on Firefox when ULS was in personal
position and you were logged out and allowed to change language.

Loading grid here already prevents graphical glitch and delaying
the click seems to prevent scrolling to wrong position.

Bug: 56937
Change-Id: Ie9acaa5a46fd903221d30c94dbc26a83355cdb64
This commit is contained in:
Niklas Laxström
2013-11-12 12:50:31 +00:00
parent aef4909616
commit 7822d5d03b

View File

@@ -423,7 +423,7 @@
mw.hook( 'mw.uls.settings.open' ).fire( eventParams && eventParams.source || 'personal' ); mw.hook( 'mw.uls.settings.open' ).fire( eventParams && eventParams.source || 'personal' );
} }
} else { } else {
mw.loader.using( 'ext.uls.mediawiki', function () { mw.loader.using( ['ext.uls.mediawiki', 'jquery.uls.grid'], function () {
$ulsTrigger.uls( { $ulsTrigger.uls( {
quickList: function () { quickList: function () {
return mw.uls.getFrequentLanguageList(); return mw.uls.getFrequentLanguageList();
@@ -441,7 +441,13 @@
onVisible: function () { onVisible: function () {
mw.uls.addEventLoggingTriggers(); mw.uls.addEventLoggingTriggers();
} }
} ).trigger( 'click', eventParams ); } );
// Allow styles to apply first and position to work by
// delaying the activation after them.
window.setTimeout( function () {
$ulsTrigger.trigger( 'click', eventParams );
}, 0 );
e.stopPropagation(); e.stopPropagation();
} ); } );