Page MenuHomePhabricator

Language button is not always clickable due to ext.uls.interface module being loaded on pages it is not used
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  1. Log in
  2. In Special:Preferences disable the compact languages link feature like so:

Screen Shot 2021-07-22 at 9.35.48 AM.png (228×1 px, 39 KB)

  1. Visit https://de.wikipedia.org/wiki/Berlin
  2. Click the language button

Screen Shot 2021-07-22 at 9.38.30 AM.png (292×532 px, 35 KB)

What happens?:

Most of the time the language dropdown shows like so:

Screen Shot 2021-07-22 at 9.38.53 AM.png (1×608 px, 83 KB)

However, occasionally no menu will show like so:

Screen Shot 2021-07-22 at 9.39.19 AM.png (298×506 px, 43 KB)

I was able to replicate this 1 / 10 times.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

Issue occurred on German Wikipedia.

The following gadgets are enabled:

Screen Shot 2021-07-22 at 9.36.11 AM.png (166×1 px, 63 KB)

Screen Shot 2021-07-22 at 9.36.40 AM.png (120×1 px, 38 KB)

Screen Shot 2021-07-22 at 9.36.54 AM.png (76×1 px, 20 KB)

The Content Translation beta feature is enabled.

I was unable to replicate on https://de.wikipedia.org/wiki/Berlin?safemode=1

Developer notes

It's possible the class vector-menu--hide-dropdown is related.

Inspecting the code this class is removed if the module ext.uls.interface is being loaded. Presumably a race condition exists where some code loads that module.

https://gerrit.wikimedia.org/g/mediawiki/skins/Vector/+/b621b3836f9d2396e379e11cd1d788984c7f3d00/resources/skins.vector.js/languageButton.js#6

QA steps

Scenario 1

Scenario 2

QA Results - Beta

ACStatusDetails
1T287191#7265244
2T287191#7265244

QA Results - Prod

ACStatusDetails
1T287191#7265262
2T287191#7265262

Event Timeline

ext.uls.interface is never loaded by any module as a dependency from looking at code search.
This suggests https://gerrit.wikimedia.org/g/mediawiki/extensions/UniversalLanguageSelector/+/5a7a6a5fe30e2e64119c134e7dca7d737a0d4fe3/includes/UniversalLanguageSelectorHooks.php#135 is what loads it.

Something looks off with this logic. Both ULSEnableAnon and ULSEnable are true by default, but this function does not consider the preferences setting that requests that the code is never loaded.

@Nikerabbit @santhosh is there a reason this module is always loaded?

Perhaps Vector needs to also check the value of mw.config.get( 'wgULSisCompactLinksEnabled' ) if that behaviour is correct.

Both ULSEnableAnon and ULSEnable are true by default, but this function does not consider the preferences setting that requests that the code is never loaded.

Those two variables should probably be removed altogether.

There is no preference setting for disabling ULS. We expanded the scope of "disable compact language links" to "disable new vector language selector". It does not make sense to expand it further to "disable uls". I think you want to check that variables whether ULS attaches itself to the new language selector, as that is what ULS does: https://gerrit.wikimedia.org/g/mediawiki/extensions/UniversalLanguageSelector/+/01c7a4fb0b0cb788c5266aebe9388612c49ba20c/resources/js/ext.uls.interface.js#526

Change 708164 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Do not rely on load order for disabling language button fallback

https://gerrit.wikimedia.org/r/708164

@Nikerabbit I think the logic in the above is more reliable, although not perfect. T286932 might add a hook we could use instead but I think we'd still have the race condition problem if the hook fires before Vector's code loads. Do you think the above is a suitable solution? If so, should I put it through my team's process?

I think that your patch a good simple solution for the time being and you can proceed with your processes.

We can discuss the ideal long term solution separately. Doesn't mw.hook remember events so that you receive events fired even before subscription?

Thanks @Nikerabbit for the guidance here!

We can discuss the ideal long term solution separately. Doesn't mw.hook remember events so that you receive events fired even before subscription?

I don't think it does, but I may be wrong. I'd have to look into the code.

Change 708164 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Do not rely on load order for disabling language button fallback

https://gerrit.wikimedia.org/r/708164

This one can't easily be QAed but I'd suggest we at least verify the button works.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Scenario 1
Visit https://en.wikipedia.beta.wmflabs.org/wiki/Selenium_language_test_page incognito window
Click the language button
✅ AC1: Expected: the dialog shows with "search for language"

Screen Shot 2021-08-05 at 2.53.27 PM.png (709×878 px, 155 KB)

Scenario 2
Login
Visit https://en.wikipedia.beta.wmflabs.org/wiki/Special:Preferences and disable the box "Use a compact language list, with languages relevant to you." at bottom of appearance section
Visit https://en.wikipedia.beta.wmflabs.org/wiki/Selenium_language_test_page
Click the language button
✅ AC2: Expected: a scrollable list should appear.
I duplicated the language element to get a scroll bar to appear

Screen Shot 2021-08-05 at 3.00.50 PM.png (767×878 px, 173 KB)

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Scenario 1
Visit https://en.wikipedia.org/wiki/Albert_Einstein incognito window
Click the language button
✅ AC1: Expected: the dialog shows with "search for language"

Screen Shot 2021-08-05 at 3.04.10 PM.png (682×855 px, 226 KB)

Scenario 2
Login
Visit https://en.wikipedia.org/wiki/Special:Preferences and disable the box "Use a compact language list, with languages relevant to you." at bottom of appearance section
Visit https://en.wikipedia.org/wiki/Albert_Einstein
Click the language button
✅ AC2: Expected: a scrollable list should appear.

Screen Shot 2021-08-05 at 3.04.47 PM.png (879×853 px, 347 KB)

Edtadros updated the task description. (Show Details)