Page MenuHomePhabricator

"Jump back up" feature for reference backlinks doesn't work with Parsoid
Open, Needs TriagePublicBUG REPORT

Description

When using Parsoid as parser and clicking on a re-used ref there's another link and text added to the backlinks list.

Steps to replicate the issue (include links if applicable):

  • Visit a page with reference reuse and the Parsoid parser e.g. en:Castle
  • Click on the footnote [10]

What happens?:

  • View jumps down to the references and highlights the backlinks
  • You see the text jump up to: as part of the content and an additional backlink c

What should have happened instead?:

  • No additional text and the backlinks a b only

See:

JumpTo Parsoid Bug.gif (1,208×450 px, 287 KB)

Note:
This only happens in Parsoid mode. Not on the legacy Parser output.

Steps to address the issue:

  • Fix to not show the buggy text
  • Make the feature work on Parsoid

Event Timeline

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

[mediawiki/extensions/Cite@master] Fix "Jump up to:" text being shown with Parsoid

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

thiemowmde added a project: Accessibility.
thiemowmde added a subscriber: ssastry.

The reason for this unexpected behavior is that the Parsoid output differs from core's parser in a way that's significant here. It appears like the decision was made to render the plain text up arrow in front of the backlink labels not as a plain text node in HTML but via a ::before rule in CSS (see https://gerrit.wikimedia.org/r/170936 and T86782).

I think it's reasonable to argue that Parsoid breaks a contract here. We tried hard to make our ext.cite.highlighting.js module as robust as possible (see e.g. T210520). Still it needs to make a few assumptions. One of them is that it can find the up arrow as a text node and replace it with a clickable link (see T205271). Instead the first node the module can find is the accessibility label added by ext.cite.a11y.js. I added an exception for this, see https://gerrit.wikimedia.org/r/1113753.

Note the ext.cite.highlighting.js module is still (partially) broken in Parsoid. To make T205271 work again I suggest to partially undo https://gerrit.wikimedia.org/r/170936. @ssastry, what do you think?

Change #1113753 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix "Jump up to:" text being shown with Parsoid

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

Moving to watching. We're waiting on feedback on how to solve this best from CTT.

thiemowmde renamed this task from Written out "jump up to" content added to backlinks on Parsoid to "Jump back up" feature for reference backlinks doesn't work with Parsoid.Feb 5 2025, 9:21 AM
thiemowmde removed thiemowmde as the assignee of this task.

This is a regression? This used to work. What is needed from CTT.

@cscott, I tried to describe the issue in my comment T384204#10488178. The problem is that the Parsoid renderer is not compatible with the legacy renderer in case the up-arrow in front of a reference list item is plain text. It appears like this was a decision made in 2015 by the parsing team (see https://gerrit.wikimedia.org/r/170936 where the createTextNode call was removed in favor of some CSS-only :before).

This breaks the "Jump back up" accessibility feature we added via T205271. That feature dynamically turns the plain-text up-arrow into a link when it can.

Our question is if the parsing team is fine with us reverting that up-arrow to a plain-text node?

Yes, there's already a phab task for "replace CSS with literal text for backlinks" (T370027) and this should probably be considered a subtask of that.