Page MenuHomePhabricator

Avoid using jQuery.show/hide in Translate
Closed, ResolvedPublic

Description

In most cases these methods do way more than what is needed. In some cases we are even mixing hide class (from ULS grid) and these methods, which is confusing (e.g. Special:PagePreparation).

Usage should be replaced with hide class from the grid, or separate prefixed class that does the same, and add/remove that class directly with JavaScript.

After fixing all instances, this can be enforced with eslint.

Event Timeline

Change 641694 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in groupselector

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

Change 641707 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in languagestats

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

Change 641694 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in groupselector

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

Change 641809 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in manage message groups

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

Change 641930 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in pagemigration

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

Change 641953 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in page preparation

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

Submitted separate patches to remove usage of .hide / .show from the each pages. After these are merged, do another sanity check to ensure all instances are removed, and then add an eslint rule.

Change 641953 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in page preparation

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

Change 641930 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in pagemigration

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

Change 641707 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in languagestats

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

Change 643929 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Add no-jquery/no-visibility rule of ESLint

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

Replaced all occurrences of .show, .hide, .toggle and added ESLint rule: no-jquery/no-visibility that will throw errors if these are used in the future.

Change 641809 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove usage of jQuery show/hide in manage message groups

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

Change 643929 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Add no-jquery/no-visibility rule of ESLint

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

Tested the following pages on translatewiki.net:

  1. language stats
  2. page preparation
  3. group selector
  4. translation stats

Could not test the page migration as that was giving an error in the API response for: https://translatewiki.net/w/api.php?action=query&format=json&list=messagecollection&mcgroup=page-Group_descriptions&mclanguage=en&mcprop=definition

Translation to English is disabled: English is the source language. Suggest improvements at [[Support]].

But that page has been tested locally.