Page MenuHomePhabricator

[L] Allow users to navigate within the category structure in upload wizard
Closed, ResolvedPublic

Description

This ticket is part of the EPIC T383055

Background

The Commons categorization principle suggest that: "The page (file, category) should be put in the most specific category/categories that fit(s) the page (not directly to its parent categories)"
However, the current categories field in the upload wizard does not facilitate that. This ticket is to allow users to navigate to subcategories thereby allowing them to discover and choose more specific category in the autocomplete list.

Acceptance criteria

Initial autocomplete list

  • an arrow should be appended to parent category names in autocomplete list to indicate there are subcategories as shown in the mock below
    • append the Ascii Rightwards Arrow →
    • make sure the RTL interface uses the Leftwards Arrow ← - can't be tested until the relevant patch is merged. It's implemented in messages, so RTL ones aren't yet translated
  • the parent category name in the autocomplete list will take users to a list of subcategories
categories_1.png (1×1 px, 135 KB)
categories UW field mobile 1.png (852×393 px, 79 KB)

Subcategory list

  • once on the subcategory list, users can go back to the previous list using the "Leftwards arrow" as shown in the mock below.
    • make sure the RTL interface users "Rightwards Arrow" to go back to previous list - can't be tested until the relevant patch is merged. It's implemented in messages, so RTL ones aren't yet translated
  • the parent category name will be shown at the top as shown in the mock below - name in normal weight instead of bold, and PARENT CATEGORY (smaller, capitalized) instead of (parent category)
  • clicking on the parent category name or other category names will input that category in the input box and close the menu - we decided to leave the menu open
  • users can continue to traverse down to any further sub categories following the same structure as above
categories_2.png (1×1 px, 137 KB)
categories UW field mobile 2.png (852×393 px, 77 KB)

Not included in this ticket

  • Showing a full list of sub categories would require additional interactions such as adding the ability to scroll within autocomplete list which will be covered in a separate ticket - T383721

Event Timeline

Sneha renamed this task from Allow users to navigate within the category structure in upload wizard - Part 1 to Allow users to navigate within the category structure in upload wizard.Jan 14 2025, 7:20 PM
Sneha updated the task description. (Show Details)
MarkTraceur renamed this task from Allow users to navigate within the category structure in upload wizard to [L] Allow users to navigate within the category structure in upload wizard.Jan 15 2025, 5:30 PM

Change #1119097 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/UploadWizard@master] Add deep category navigation

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

FYI there is no need to QA the RTL support - those are in i18n messages, for which translation will not begin before the patch is merged (i.e. will not be available when this is tested)

mfossati updated the task description. (Show Details)

Change #1119097 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Add deep category navigation

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

@mfossati - the following spec doesn't quite work for me on commons beta.

  • clicking on the parent category name or other category names will input that category in the input box and close the menu - we decided to leave the menu open

In production, I can click on a parent category and add it directly (which is, of course, discouraged by Commons:Categories#Modularity_principle).
On commons beta, a parent category will display an arrow. Clicking anywhere in the parent category label, will, naturally, expand subcategories. With expanded subcategories, clicking on a parent category won't do anything.
Still, I can add a parent category by typing the full name, or, sometime, by persistently clicking on it (only for a parent with one level of subcategories).

Steps:

  • On commons beta, in UW Category field enter "Test" (without quotes).
  • there will be "Test files" with the arrow indicating subcategories; click on "Test files"
  • the subcategories will be displayed, but it's still not possible to add a parent category "Test files"

Screen Shot 2025-02-20 at 12.20.30 PM.png (512×1 px, 71 KB)

There are the ways to add a parent category

  • by double-clicking on the parent category title (works in a non-deterministic way, sort of)
  • by entering the entire name (not selecting it from the list of suggestions).

Checked on commons beta for

  • single/multiple upload on desktop/mobile
  • RTL
Screen Shot 2025-02-20 at 11.33.16 AM.png (976×1 px, 109 KB)
Screen Shot 2025-02-20 at 11.33.28 AM.png (516×1 px, 69 KB)
Screen Shot 2025-02-20 at 2.19.13 PM.png (1×1 px, 156 KB)
Screen Shot 2025-02-20 at 2.30.23 PM.png (684×1 px, 76 KB)

Notes:

(1) On comons beta - the Category field won't display suggestions when if a search terms have leading/trailing spaces. Production - commons wmf.17 successfully ignores those spaces.

(2) Not entirely sure if sorting order of suggested Categories (in the drop-down list of suggestions) on commons beta matches the sorting categories on commons wmf.17. If there is an easy way to check it, it'd be great.

Change #1121566 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/UploadWizard@master] Move arrows into code

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

(1) On comons beta - the Category field won't display suggestions when if a search terms have leading/trailing spaces. Production - commons wmf.17 successfully ignores those spaces.

https://gerrit.wikimedia.org/r/1121566 should fix it.

(2) Not entirely sure if sorting order of suggested Categories (in the drop-down list of suggestions) on commons beta matches the sorting categories on commons wmf.17. If there is an easy way to check it, it'd be great.

CC @matthiasmullie .

Change #1121566 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Move arrows into code & trim manual input

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

Notes:

(2) Not entirely sure if sorting order of suggested Categories (in the drop-down list of suggestions) on commons beta matches the sorting categories on commons wmf.17. If there is an easy way to check it, it'd be great.

The search API call has remained exactly the same (except for getting more results from the API), so that shouldn't change!

Notes:

(2) Not entirely sure if sorting order of suggested Categories (in the drop-down list of suggestions) on commons beta matches the sorting categories on commons wmf.17. If there is an easy way to check it, it'd be great.

The search API call has remained exactly the same (except for getting more results from the API), so that shouldn't change!

Thanks, @Matthias for checking!

Re-checked on commons beta - both fixes are in place, i.e.

  • when leading/trailing spaces are present for entering categories - the suggestions are successfully shown
  • parent categories can be added just by clicking on them, i.e. the first click on a parent category will show a sub-categories list. Then clicking on a parent category will add it to the Category field.

Notes:

(2) Not entirely sure if sorting order of suggested Categories (in the drop-down list of suggestions) on commons beta matches the sorting categories on commons wmf.17. If there is an easy way to check it, it'd be great.

The search API call has remained exactly the same (except for getting more results from the API), so that shouldn't change!

Thanks, @Matthias for checking!

Nope, thanks for bringing this up, because I've meanwhile realized that the order may actually be different: we're using the search as "generator" now in order to also immediately capture subcategory information; but that presents the results in object literal (where order is not guaranteed) rather than array form. I've submitted another small patch to do an explicit sort!

Change #1122069 had a related patch set uploaded (by Matthias Mullie; author: Matthias Mullie):

[mediawiki/extensions/UploadWizard@master] Sort search results per index

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

Change #1122069 merged by jenkins-bot:

[mediawiki/extensions/UploadWizard@master] Sort search results per index

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

QA Testing notes for a post-deployment check.

(1) check on sorting - check the following search terms (and compare the results), see the table below:

commons wmf.17commons wmf.18
Special:Categories page
Screen Shot 2025-02-24 at 12.33.25 PM.png (1×1 px, 146 KB)
Screen Shot 2025-02-26 at 1.12.43 PM.png (928×1 px, 124 KB)
Upload Wizard
Screen Shot 2025-02-24 at 12.34.03 PM.png (1×1 px, 120 KB)
Screen Shot 2025-02-26 at 12.57.06 PM.png (934×1 px, 122 KB)
Upload Wizard
Screen Shot 2025-02-24 at 12.30.40 PM.png (1×1 px, 169 KB)
Screen Shot 2025-02-26 at 12.59.59 PM.png (1×2 px, 209 KB)
Upload Wizard
Screen Shot 2025-02-20 at 11.26.12 AM.png (1×1 px, 159 KB)
Screen Shot 2025-02-26 at 1.03.30 PM.png (1×1 px, 150 KB)

Note: a minor big about categories titles not being wrapped was filed - T387393
(2) check on traversing categories

commons betacommons wmf.18
Screen Shot 2025-02-20 at 11.33.16 AM.png (976×1 px, 109 KB)
Screen Shot 2025-02-20 at 11.33.28 AM.png (516×1 px, 73 KB)
Screen Shot 2025-02-26 at 1.07.41 PM.png (962×1 px, 118 KB)
Screen Shot 2025-02-26 at 1.07.51 PM.png (694×1 px, 78 KB)
RTL
Screen Shot 2025-02-20 at 2.30.23 PM.png (684×1 px, 78 KB)
Screen Shot 2025-02-20 at 2.19.13 PM.png (1×1 px, 152 KB)
Screen Shot 2025-02-26 at 1.09.12 PM.png (1×2 px, 160 KB)
Screen Shot 2025-02-26 at 1.09.23 PM.png (1×2 px, 159 KB)