Page MenuHomePhabricator

Create mechanism to prevent collisions between section IDs and native element IDs
Open, Needs TriagePublic

Description

This is perhaps low priority, but I'll still file this as I don't think this is OK. Right now there seems to be no mechanism at all to deal with section IDs that collide with IDs already used for native elements of the skin, so sections that use the same name as existing IDs are not reachable via the table of contents. This can be witnessed at this test page.

Also, if you use the same name for a section as is used for some tool list, gadgets and user scripts will add their links to this section instead of the tool list (they usually use mw.util.addPortletLink for this purpose). For example, this is the result of one of the popular ruwiki user scripts running:

image.png (104×286 px, 6 KB)

Perhaps the scale of the problem is not particularly large (which would explain why there was no such task aside from T206906), but in English Wikipedia alone, there are at least 100 sections named "content" and 80 sections named "top" that aren't reachable from the TOC. I've counted 95 elements with the id parameter on a 404 page on Vector in English Wikipedia (although most of them, such as t-whatlinkshere, are complex and unlikely to be used as section names).

This task generalizes T206906: Dummy anchor with id="top" at the top of the page breaks links to section named "top".