Page MenuHomePhabricator

Make label manager columns sortable
Closed, ResolvedPublicFeature

Description

The 'Label' and 'Items' columns of Special:WatchlistLabels should be sortable.


Derived Requirement

Enable sorting for the Label and Items columns on *Special:WatchlistLabels*.
Users must be able to sort labels in ascending and descending order by label name and by the number of watchlist items.
Sorting behavior must be consistent, deterministic, and correctly reflected in the table UI.

Test Steps

Test Case 1: Verify Label column is sortable

  1. Log in to the wiki.
  2. Navigate to *Special:WatchlistLabels*.
  3. Click the Label column header.
  4. Observe the order of labels.
  5. Click the Label column header again.
  6. ✅❓❌⬜ AC1: Confirm labels sort alphabetically in ascending order on first click and descending order on second click.

Test Case 2: Verify Items column is sortable

  1. On *Special:WatchlistLabels*, click the Items column header.
  2. Observe the order of labels based on item count.
  3. Click the Items column header again.
  4. ✅❓❌⬜ AC2: Confirm labels sort numerically by item count in ascending order on first click and descending order on second click.

Test Case 3: Verify sorting indicators are displayed

  1. Click the Label column header.
  2. Observe the column header UI.
  3. ✅❓❌⬜ AC3: Confirm a visual indicator (e.g., arrow) appears showing the active sort column and direction.

Test Case 4: Verify sorting persists during interaction

  1. Apply sorting to either Label or Items column.
  2. Refresh the page.
  3. ✅❓❌⬜ AC4: Confirm the selected sort order persists after refresh or resets consistently to a documented default.

QA Results -Beta

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1214467 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Add sorting to Special:WatchlistLabels

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

Change #1214467 merged by jenkins-bot:

[mediawiki/core@master] Add sorting to Special:WatchlistLabels

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

@Samwilson Please review AC1, thanks!

Test Result - Beta

Status: ✅ PASS ❌ FAIL
Environment: Beta: 1.46.0-alpha (b7d0aef) 19:07, 16 December 2025
OS: macOS Tahoe 26.1
Browser: Chrome 142
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://en.wikipedia.beta.wmcloud.org/wiki/Special:WatchlistLabels?offset=&limit=5&sort=name&asc=&desc=1

Test Steps

Test Case 1: Verify Label column is sortable

  1. Log in to the wiki.
  2. Navigate to *Special:WatchlistLabels*.
  3. Click the Label column header.
  4. Observe the order of labels.
  5. Click the Label column header again.
  6. ❌AC1: Confirm labels sort alphabetically in ascending order on first click and descending order on second click.

Sorting is off with ascending and descending, as seen in the video below.

Test Case 2: Verify Items column is sortable

  1. On *Special:WatchlistLabels*, click the Items column header.
  2. Observe the order of labels based on item count.
  3. Click the Items column header again.
  4. ⬜ AC2: Confirm labels sort numerically by item count in ascending order on first click and descending order on second click.

Cannot link Items just yet, until T411611: Create popup for adding labels is completed

Test Case 3: Verify sorting indicators are displayed

  1. Click the Label column header.
  2. Observe the column header UI.
  3. ✅ AC3: Confirm a visual indicator (e.g., arrow) appears showing the active sort column and direction.

See AC1

Test Case 4: Verify sorting persists during interaction

  1. Apply sorting to either Label or Items column.
  2. Refresh the page.
  3. ✅ AC4: Confirm the selected sort order persists after refresh or resets consistently to a documented default.

See AC1

GMikesell-WMF changed the task status from Open to In Progress.Dec 16 2025, 7:56 PM
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from QA to In Development on the Community-Tech (Fox Squad) board.

Change #1218864 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Sort Special:WatchlistLabels columns by unformatted values

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

Thanks for finding this @GMikesell-WMF the sorting has been broken since we added the checkboxes! Oops. Hopefully the above patch will fix it up.

Change #1218864 merged by jenkins-bot:

[mediawiki/core@master] Sort Special:WatchlistLabels columns by unformatted values

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

@Samwilson Sorting on Desktop looks good, but on mobile, when I click on the sorting, it goes to the home page for some reason. Also a side issue, when I click on sorting, the delete button flickers. I'm not sure if it matters or if you'd like a separate task for it.

Test Result - Beta

Status: ✅ PASS ❌ FAIL
Environment: Beta: 1.46.0-alpha (ec5cd6e) 15:05, 17 December 2025
OS: macOS Tahoe 26.1
Browser: Chrome 143
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://en.wikipedia.beta.wmcloud.org/wiki/Special:WatchlistLabels?offset=&limit=5&sort=name&asc=&desc=1

Test Steps

Test Case 1: Verify Label column is sortable

  1. Log in to the wiki.
  2. Navigate to *Special:WatchlistLabels*.
  3. Click the Label column header.
  4. Observe the order of labels.
  5. Click the Label column header again.
  6. ❌AC1: Confirm labels sort alphabetically in ascending order on first click and descending order on second click.
✅Desktop❌Mobile

Thanks!

  • The weird mobile behaviour is not due to mobile, but because you're viewing the page there via the ?title=Special:WatchlistLabels rather than /Special:WatchlistLabels. I've opened a bug report for it: T413046: Codex-PHP: Table sort URLs don't keep other parameters
  • The flicker of the delete button is due to the speed of loading of the Javascript interface (i.e. it loads for the non-JS interface as not disabled, and is then disabled when JS comes along and determines that nothing is yet selected), and I don't think is anything to worry about.

So all good here, and I'll try to sort out the bug separately.

Got it! I'll mark this as Resolved since there is another task for Mobile. Thanks for all your work!

GMikesell-WMF updated the task description. (Show Details)