Page MenuHomePhabricator

Selflinks should still be <a> tags with CSS styling via a class, not <strong> tags
Closed, ResolvedPublic0 Estimated Story Points

Description

It's a pain to cope with and totally inelegant.

Tagging "Parser", though I believe these are made by Linker.

Whilst we're at it, we should use mw-selflink as the class name, to go with mw-redirect and mw-disambig.

Event Timeline

So these would be clickable?

At the decision of the renderer; in VE (where you need to interact with them), yes, in read-mode they could have pointer-events: none or whatever.

If that's a problem, we could make them literally <a>foo</a> (with no href), then they wouldn't be clickable and they wouldn't be styled as links.

Change 343204 had a related patch set uploaded (by Jforrester):
[mediawiki/core] [WIP] Linker: Render selflinks as classed <a>s, not <strong>s

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

and they wouldn't be styled as links

Well most selectors target a and not a[href] so there's still some overriding to do.

Change 343204 merged by jenkins-bot:
[mediawiki/core@master] Linker: Render selflinks as href-less classed <a>s, not <strong>s

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

Change 345525 had a related patch set uploaded (by Esanders):
[mediawiki/core@master] Follow-up If0588439: Fix color of active & visited selflinks

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

Change 345525 merged by jenkins-bot:
[mediawiki/core@master] Follow-up If0588439: Fix color of active & visited selflinks

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

"It's a pain to cope with and totally inelegant."
Could you expand on this and give some context?

To me, it seems super strange (and broken) to have an anchor tag that will be styled by browser defaults as a link and clickable.
Other people do things with our content too outside MediaWiki (and we do too - mobile apps being one example), so why are we rendering this as a link and expecting the client rendering our content to know how to deal with it (it seems like change caused T181472 only just discovered)?

I don't actually think rendering a link without a href is actually very semantic nor helpful so I don't really understand why this was converted from a strong tag to a mw-selflink. Could you explain the history/rationale here?

I was about to completely agree with Jdlrobson, but actually such links are HTML5's "placeholder links" and seem to be the recommended way…

References: