Fix language switching using the undo tooltip

Introduced in I740600d18859422b2f98a5ef92d0321f6e9615a2.

We need to prevent the default action (navigating a link) so that
our custom code has a chance to run. Before it was synchronous so
it called location.href before default action had a chance to execute.
When it was made asynchronous, the default action got executed before
our custom code.

Change-Id: I292f99aa5f5ff536d8197174c317018462685866
This commit is contained in:
Niklas Laxström
2020-10-28 12:11:30 +01:00
committed by Abijeet Patro
parent 094c30bc1c
commit 5cb2aec0a1

View File

@@ -192,6 +192,8 @@
dir: 'auto' dir: 'auto'
} ) } )
.on( 'click', function ( event ) { .on( 'click', function ( event ) {
event.preventDefault();
// Track if event logging is enabled // Track if event logging is enabled
mw.hook( 'mw.uls.language.revert' ).fire(); mw.hook( 'mw.uls.language.revert' ).fire();