Use ev.currentTarget not ev.target

In modern Vector, the ULS trigger button has a child node which is
a span. When clicks are received on the span, they will result
in positioning relating to the span rather than the button.

The ev.currentTarget should be read outside the asynchronous function
to avoid bubbling.

Bug: T276248
Change-Id: I6e138c88e29b335b8e0bc22cf0aa07c289a5eb74
This commit is contained in:
jdlrobson
2021-04-21 11:40:00 -07:00
committed by Jdlrobson
parent c496e9bfdf
commit ec8edeb8ec

View File

@@ -454,12 +454,12 @@
* @param {jQuery.Event} ev
*/
function loadContentLanguageSelector( ev ) {
var $target = $( ev.currentTarget );
ev.preventDefault();
mw.loader.using( 'ext.uls.mediawiki' ).then( function () {
var $target, parent, languageNodes, standalone, uls;
var parent, languageNodes, standalone, uls;
$target = $( ev.target );
parent = document.querySelectorAll( '.mw-portlet-lang, #p-lang' )[ 0 ];
languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : [];
standalone = isUsingStandaloneLanguageButton();