From 5cb2aec0a1b6c87c837fc10b206f466559a0ebb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Laxstr=C3=B6m?= Date: Wed, 28 Oct 2020 12:11:30 +0100 Subject: [PATCH] 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 --- resources/js/ext.uls.interface.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 057264df..a89a5e07 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -192,6 +192,8 @@ dir: 'auto' } ) .on( 'click', function ( event ) { + event.preventDefault(); + // Track if event logging is enabled mw.hook( 'mw.uls.language.revert' ).fire();