diff --git a/resources/skins.vector.js/languageButton.js b/resources/skins.vector.js/languageButton.js index a908b3a18..63ca97f44 100644 --- a/resources/skins.vector.js/languageButton.js +++ b/resources/skins.vector.js/languageButton.js @@ -5,7 +5,9 @@ * has been released and contains this */ function addInterwikiLinkToMainMenu() { - const editLink = document.querySelector( '#p-lang-btn .wbc-editpage' ); + const editLink = /** @type {HTMLElement|null} */ ( + document.querySelector( '#p-lang-btn .wbc-editpage' ) + ); if ( !editLink ) { return; @@ -26,7 +28,7 @@ function addInterwikiLinkToMainMenu() { addInterlanguageLink.addEventListener( 'click', function ( /** @type {Event} */ e ) { e.preventDefault(); // redirect to the detached and original edit link - editLink.dispatchEvent( new Event( 'click' ) ); + editLink.click(); } ); } }