mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-12 09:21:11 +00:00
languageButton: Use click method instead of dispatchEvent
For pages with interlanguage links, this link has no event listener and only functions as a plain link to the corresponding Wikidata page. Bug: T336931 Change-Id: I8c1456b3c524824ccc59aee5f999c8017c59fc0b
This commit is contained in:
parent
3fae89e967
commit
8457b64a83
|
@ -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();
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue