Page MenuHomePhabricator

[Task] Avoid id="coordinates" in HTML ArticlePlaceholder output
Closed, ResolvedPublic

Description

On http://en.wikipedia.beta.wmflabs.org/wiki/Special:AboutTopic/Q12480 the "coordinates" are places very weird. Reason is that some unrelated CSS kicks in, because the HTML renders as <span id="coordinates">, and this does have a special meaning on Wikipedia pages for a long time. ArticlePlaceholder should avoid creating HTML with this ID.

Event Timeline

thiemowmde assigned this task to Lucie.
thiemowmde raised the priority of this task from to Medium.
thiemowmde updated the task description. (Show Details)
thiemowmde added subscribers: thiemowmde, Lucie, hoo.

This is MediaWiki magic, it takes the value of the h2 ArticlePlaceholder sets and makes it into a wrapping span id.

It converts <h2>Content</h2> into <h2><span class="mw-headline" id="Content">Content</span></h2>. Not sure how you would fix this…

I honestly have no idea. :-( The "fun" thing is that this issue also exists in regular articles! Edit one, add ==coordinates== and hit preview. Surprise! This should be fixed.

Hm… this is really awry. So core sets these ids in order to allow linking to sections, thus just renaming these probably wont work.

The best solution would be for the actual coordinate class to get prefixed (like page-coordinates or top-coordinates or something like that). Core could be hacked to avoid setting these ids and not loose functionality (at least for JS enabled users), but I doubt it's worth the hassle.

We could also just use divs for these and style them ourselves, that would work around core's headline handling. Not sure that's desired though… semantically these are (kind of) headlines.

The most correct solution would be to fix the unspecific #coordinates selector in all local CSS files:

Fixing either by making it more specific, which is not possible, unfortunately. Or by disabling the styles for headlines:

h2 #coordinates,
h3 #coordinates {
    position: static;
    float: none;
    font-size: unset;
}

Change 286664 had a related patch set uploaded (by Lucie Kaffee):
Avoid id="coordinates" in HTML ArticlePlaceholder output

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

For now I chose the cheap solution of just upper-casing the strings with "coordinates". Don't the nicest solution but maybe bearable for now.

Change 286664 merged by jenkins-bot:
Avoid id="coordinates" in HTML ArticlePlaceholder output

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

Lucie moved this task from Review to Done on the ArticlePlaceholder board.