We should always sort files by filename when adding new uploads. The order of input.files is unpredictable, and people prefer sequentially named files to appear in sequence. Reported: https://commons.wikimedia.org/wiki/Commons:Upload_help#Bug_with_sequential_numbering @deryckchan
I'm not sure *always* sort by filename is a satisfactory solution. I think some users might want to manually arrange the files in their desktop browser so they'd be numbered correctly after uploading.
An *option* to sort by filename after selecting the files or even arrange the order of files will be better.
Could we just decouple the software's sorting of the files and the sorting in the interface? Currently it's sorted by "when was this upload added to the wizard" which we could do simply by adding a field to the upload object...then sort by title/date/whatever else in another patch. Might solve some of our endemic problems with the upload array too.
I'm going to draft a solution for that.
I think the crux of this problem is that when one batch-chooses files to be added to the upload wizard, the order of files is well-behaved on most desktop browsers but unpredictable on most mobile platforms. So I'm wondering how we can find a solution that will make UploadWizard auto-numbering useful for mobile users without breaking the desktop edition.
Ugh, so, I forgot the perennial problem: Copying metadata.
We expect the first upload in the program's array of uploads to be at the top, so we can copy all of its metadata to the others.
Ways to fix:
- Separate copying metadata out from any one upload, and just have one interface above or beside the rest of the uploads for entering mass metadata.
- Allow copying metadata from any upload.
I like the second option for its simplicity. I will draft that first, and see what happens.
The copy-thingy's behavior has changed a bit recently; it'll attach to whichever is listed first (in this.uploads) and will remove/reattach if the array of uploads changes.
If we were to decouple interface & this.uploads order, all we'd need to do it just change which of the uploads it treats as "first".
Instead of taking the first valid thing in this.uploads, it could take whichever is displayed at the top, and it'll just add the copy-widget there.