Page MenuHomePhabricator

Tablesorter places sort arrows to wrong row
Closed, ResolvedPublic

Description

Special:InviteSignup has following table structure:

<table> <thead> <tr> <th></th> </tr> <tr> <td></td> </tr> </thead> <tr> <td></td> </tr> </table>

Sortable table places the sort arrows on the second tr, where I would expect them to be on the first one. I've identified the cause to be in buildHeaders line 314 of jquery.tablesorter.js:

				if ( cellArray.length >= maxSeen ) {

This makes it choose last longest row, instead of the first one. Changing that to '>' makes it work, but there might be better solutions.


Version: 1.22.0
Severity: normal

Details

Reference
bz53527

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:02 AM
bzimport set Reference to bz53527.
bzimport added a subscriber: Unknown Object (MLST).

Tablesorter is expecting all elements in the thead to be columnheaders currently.

DJ: Do you know if your patch in https://gerrit.wikimedia.org/r/#/c/98250/ will fix this?

No reply - I assume this was fixed by https://gerrit.wikimedia.org/r/#/c/98250/2/resources/jquery/jquery.tablesorter.js which was merged in March.

If not, please reopen.

Not fixed. It seems worse now. The arrows are not visible and all the input elements on the second header row cannot be interacted with.

TheDJ added a comment.Aug 6 2014, 11:19 AM

@Niklas, that <form> inside the row is not really valid HTML5 I think. <form> is supposed to be in http://www.w3.org/TR/html5/dom.html#flow-content-1, and though <table> is flow-content, the <tr> itself only accepts a very limited amount of children: http://www.w3.org/TR/html5/tabular-data.html#the-tr-element

We should probably get that fixed. Now looking at the rest of this report..

Change 152225 had a related patch set uploaded by TheDJ:
jquery.tablesorter: Only look at th's for headers

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

Change 152225 merged by jenkins-bot:
jquery.tablesorter: Only look at th's for headers

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