Page MenuHomePhabricator

Parsoid-generated selflinks should not be clickable links
Open, Needs TriagePublicBUG REPORT

Assigned To
None
Authored By
stjn
Apr 28 2026, 10:05 PM
Referenced Files
F88647072: image.png
Mon, Jun 15, 2:21 PM
F88646842: image.png
Mon, Jun 15, 2:21 PM
F88640077: image.png
Mon, Jun 15, 2:21 PM
F88554242: image.png
Jun 15 2026, 12:42 AM
F88554737: image.png
Jun 15 2026, 12:42 AM

Description

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

<a rel="mw:WikiLink" href="//en.wikipedia.org/wiki/User:SSastry_(WMF)/VE_Test" class="mw-selflink selflink" id="mwBw">User:SSastry (WMF)/VE Test</a>
<a class="mw-selflink selflink">User:SSastry (WMF)/VE Test</a>

What happens?:
In T69486#7613226 it is said that this was some request from DiscussionTools team. However, the current existing convention for many years was that these links are not clickable since they lead to the same page.

Although it was existing since before accessibility concerns were ever a thing, not having an actual link target does have an accessibility purpose, since that's the only thing that indicates that a link isn't actually a link to anywhere. This is especially useful for navigation templates etc. where a screen reader user won't have the same visible affordances of bold black text. For this reason I think this should be reconsidered and Parsoid should match the old parser in how it treats selflinks.

Event Timeline

If making self-links clickable is a deliberate new feature rather than a bug, it should follow standard link behaviour:

  1. The cursor should change to a hand pointer instead of an I-beam one, as seen here:
    image.png (1,570×888 px, 412 KB)
    It does so correctly only in Minerva:
    image.png (1,622×871 px, 618 KB)
  2. The self-link should receive an underline on hover (text-decoration: underline;). For comparison, standard links correctly show that underline:
    image.png (1,862×1,077 px, 512 KB)
  3. The text colour should get blue on hover consistently. Currently, this behaviour is inconsistent. When I'm logged into my account on Opera GX, the link turns blue on hover across Vector 2022, Timeless and Minerva:
    image.png (1,906×1,073 px, 800 KB)
    However, it fails to do so on other browsers, skins or logged-out sessions:
    image.png (1,612×872 px, 624 KB)
Ahecht subscribed.

The proposal at T69486#7613226 was to use CSS to disable the link behavior. However, as far as I'm aware this isn't actually possible. You can use pointer-events: none in the CSS to disable clicking and hovering, but that doesn't disable a screen reader or keyboard user from tabbing to the link and pressing enter. Parsoid could be changed to add tabindex="-1" aria-disabled="true" to the html tag itself if we really have to keep the href element, but it seems like just adding the target as a dataset property for DiscussionTools to read as opposed to an href would be less of a hack.

DiscussionTools has been able to handle self-links without href generated by the old parser, so it could surely be adapted to handle them when generated by Parsoid as well.

For Parsoid the library, this is deliberate behavior, because the original idea is that a link is a link, and self-links are reading-adapted behavior. So, if one were to take a Parsoid fragment from a page and embed it elsewhere, the "self-link" is no longer a self-link. So, Parsoid's output should be agnostic. And, the DiscussionTools scenario is one such (while recognizing that DT can be adapted to work with the removal as Bartosz notes above).

However, we now have a model where there is a separate OutputTransformPipeline that adapts the canonical parsoid output to different contexts, and desktop readviews is the first pipeline we have for this. And, in the future, we expect PCS and MobileFrontend (which are right now their own extensions / services) to effectively be their own separate Transform Pipelines that adapt Parsoid's canonical output.

All that said, now that we have the OutputTransformPipeline setup, we should be able to include a transform there to suppress self-links altogether if that is what is desired per legacy parser behavior. And, depending on where in the pipeline we put this self-link removal transform, DiscussionTools shouldn't be affected and it can still see the original canonical Parsoid HTML and shouldn't be impacted.

Should I open new tickets for the unstable behaviour shown in T424777#12016849 then?

If we make the change I am proposing above, then self-links will not be clickable, and so you shouldn't need those new tickets. So, maybe hold off for a bit?