Page MenuHomePhabricator

jquery.makeCollapsible does not handle thead and tfoot as used by jquery.tablesorter
Closed, ResolvedPublic

Description

Example of issue: [https://en.wikipedia.org/w/index.php?title=User:Mdowdell/sandbox&oldid=600478437]

As can be seen in [https://en.wikipedia.org/w/index.php?title=User:Mdowdell/sandbox&oldid=600478437#mw-collapsible_mw-collapsed_sortable] the mw-collapsed sortable table hides the second row used for sorting. However, the collapsible table [https://en.wikipedia.org/w/index.php?title=User:Mdowdell/sandbox&oldid=600478437#collapsble_collapsed_sortable] show the second row when uncollapsing the table.

The problem is that mw-collapsible does not account for table rows placed in thead and tfoot, which are used by tablesorter.
It has the selector

$collapsible.find( '> tbody > tr' );


Version: 1.23.0
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:06 AM
bzimport set Reference to bz62878.
bzimport added a subscriber: Unknown Object (MLST).

I've fixed this bug for Wikia, although jquery.makeCollapsible is different between 1.19 and the current release. The fix for 1.19 can be seen at https://github.com/Wikia/app/pull/2675/files

With the changes made in Bug 30352, this is just a matter of removing the conditional at http://git.wikimedia.org/blob/mediawiki%2Fcore.git/master/resources%2Fjquery%2Fjquery.makeCollapsible.js#L63 and always select every row. The row with the toggle should be excluded in the next conditional on L68.

I'd like to fix this myself if possible, I'm just a little unsure of how to do so with gerrit so it might take a little while for me to get around to submitting a patch.

Thanks for the report!

Here's a quickstart Gerrit guide:
https://www.mediawiki.org/wiki/Gerrit/Getting_started

Here's a detailed, extremely boring one:
https://www.mediawiki.org/wiki/Gerrit/Tutorial

And if you can't get it to work, there's a service that lets you directly upload patches in standard formats: http://tools.wmflabs.org/gerrit-patch-uploader/

TheDJ renamed this task from jquery.makeCollapsible incompatible with jquery.tablesorter to jquery.makeCollapsible does not handle thead and tfoot as used by jquery.tablesorter.Dec 21 2015, 4:13 PM
TheDJ updated the task description. (Show Details)
TheDJ set Security to None.
TheDJ added subscribers: TheDJ, Aklapper, Lejonel.

I looked at this again. At first I was very confused because I couldn't reproduce the problem. Then I realized that it depends on the order in which the two scripts run – sortable-then-collapsible is good; collapsible-then-sortable is bad. (This is because jquery.makeCollapsible can actually handle thead and tfoot, but it can't handle it when they are inserted after it was already initialized on a table.) Conveniently, that makes the bug easy to fix!

Change 586436 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/core@master] Run tablesorter before makeCollapsible

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

Change 586436 merged by jenkins-bot:
[mediawiki/core@master] Run tablesorter before makeCollapsible

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

i'm not sure if this fixes all problems, but it should fix at least 95% of them.

TheDJ removed a project: Patch-For-Review.

Provisionally closing. Please open a new ticket if you find new cases after this gets deployed next week.

Change 619601 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] mediawiki.page.ready: Simpler tablesorter/makeCollapsible call

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

Change 619601 merged by jenkins-bot:
[mediawiki/core@master] mediawiki.page.ready: Simpler tablesorter/makeCollapsible call

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