Page MenuHomePhabricator

Make a third click on a sortable header reset the table
Closed, ResolvedPublic


Once you've clicked on a column header of a sortable table, there's no way to bring back the original order other than to reload the page. This is frustrating. I've refreshed the page numerous times just to see the original state, and so have many people I imagine, which means we're wasting traffic (I know it's infinitesimal in the grand scheme of things, but still).

I suggest we make a third click on a column header reset the order of the table, as demonstrated on this page (h/t Xaosflux). Apparently both the fork on that page and our tablesorter are based on the same plugin, so I suspect it wouldn't be difficult.

Event Timeline

Nardog created this task.Jun 27 2019, 9:02 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 27 2019, 9:02 AM
TheDJ added a subscriber: TheDJ.

The versions of those plugins have wildly diverged since 2012 ('ish?).

Tablesorter is kept alive by volunteer effort, patches are welcome for this task.

@Tchanders Can you take a look at this?

Change 598877 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] jquery.tablesorter: Return to initial order on third click

I had a look into this - there's a patch up to show how it could be done.

I wonder if the UI would be confusing if a column was already sorted to begin with - the third click might then appear to do nothing?

@Tchanders Wow, thanks a lot!

I wonder if the UI would be confusing if a column was already sorted to begin with - the third click might then appear to do nothing?

I for one think the triangle indicators on the headers would be enough to indicate what happens (also if the table used rowspans it would be obvious—assuming the third click would restore them).

That makes sense - the double indicators return when it's sorted in the initial order, and the title on hover (which already indicates whether clicking will sort ascending or descending) also indicates if returning to the initial sort order. Hopefully that makes it clear enough.

Restoring the rowspans is a bit more complicated, so I've filed a separate task: T253907

Johan added a subscriber: Johan.May 29 2020, 3:47 PM

Please let me know when you know when this will be in production and I'll add it to Tech News.

Change 598877 merged by jenkins-bot:
[mediawiki/core@master] jquery.tablesorter: Return to initial sort order on third click

Thanks @Johan - this will be going out with this week's train

TheDJ closed this task as Resolved.Jun 15 2020, 11:20 AM
TheDJ assigned this task to Tchanders.

Thanks @PrimeHunter - I've updated T253907 to include restoring sorttop/sortbottom too.