Page MenuHomePhabricator

Bad interaction between RevisionSlider and CollapsibleVector extension
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

Revision-Slider currently undoes all effects of the MediaWiki-extensions-CollapsibleVector.

CollapsibleVector is a JavaScript extension that re-adds a collapse feature to the left navigation bar. This was once a core feature, but got removed a few years ago. Note the arrow:

Screenshot from 2018-12-10 09-32-28.png (178×159 px, 7 KB)

RevisionSlider contains a feature where it replaces the diff view below the slider on-the-fly, without reloading the entire page. The code for this feature is in the file ext.RevisionSlider.DiffPage.js. In one line it replaces the contents of the #mw-panel (this is the left navigation bar) with an entirely new version as provided by the server. This is done because there are links in this navigation bar that reference the currently displayed revision, e.g. "Permanent link" and "Printable version". These would point to the wrong revision and must be replaced because of this. To make this easier, the code replaces the entire navigation bar.

This also kills all effect any JavaScript had on the navigation bar before!

Unfortunately the CollapsibleVector code currently does not use any hook, but initializes via $( function () { … } );. This can not be called again after RevisionSlider replaced the #mw-panel contents.

Ideas:

  • Try to rewrite CollapsibleVector to use the wikipage.content hook.
  • Rewrite the line of code that replaces the entire #mw-panel in one step, and instead iterate the two DOM fragments and only replace href attributes (and possibly others, e.g. title or data-…).

Reported here: https://www.mediawiki.org/wiki/Topic:Uq065ue6voxwn51d

Event Timeline

Why is this tagged as an MCR issue?

thiemowmde removed a subscriber: daniel.

Just a mistake, sorry, @daniel. The one I wanted to point you at is T211473.

awight changed the subtype of this task from "Task" to "Bug Report".Oct 30 2020, 1:53 PM

Change 638100 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/extensions/CollapsibleVector@master] Init collapsing via JS content hook

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

Change 638100 merged by jenkins-bot:
[mediawiki/extensions/CollapsibleVector@master] Init collapsing via JS content hook

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

WMDE-Fisch set the point value for this task to 2.Nov 2 2020, 3:09 PM

Change #1024371 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/extensions/CollapsibleVector@master] Create a new mw.hook 'panel'

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

Change #1024372 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/extensions/RevisionSlider@master] Fire mw.hook 'panel' after update of the #mw-panel

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

Fomafix claimed this task.
Fomafix subscribed.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CollapsibleVector/+/638100 uses the hook 'wikipage.categories' to trigger the collapsing again. This is bad, because this hook gets also triggered on every live preview. Therefor https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CollapsibleVector/+/1021554 reverts this change.

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CollapsibleVector/+/1024371 and https://gerrit.wikimedia.org/r/c/mediawiki/extensions/RevisionSlider/+/1024372/ creates a better way to trigger the collapsing again.

Change #1027092 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/extensions/RevisionSlider@master] Use $( '#t-permalink' ).parent() instead of $( '#mw-panel' )

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

Change #1024371 abandoned by Fomafix:

[mediawiki/extensions/CollapsibleVector@master] Create a new mw.hook 'panel'

Reason:

Replaced by I084c93e8fe7c7663d9de8a39433a9e92a3827196.

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

Change #1024372 abandoned by Fomafix:

[mediawiki/extensions/RevisionSlider@master] Fire mw.hook 'panel' after update of the #mw-panel

Reason:

Replaced by I084c93e8fe7c7663d9de8a39433a9e92a3827196.

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

Change #1027092 merged by jenkins-bot:

[mediawiki/extensions/RevisionSlider@master] Use $( '#t-permalink' ).parent() instead of $( '#mw-panel' )

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

Change #1027506 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: WMDE-Fisch):

[mediawiki/extensions/RevisionSlider@master] Streamline element replacement when updating the view

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

Change #1027506 merged by jenkins-bot:

[mediawiki/extensions/RevisionSlider@master] Streamline element replacement when updating the view

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