Page MenuHomePhabricator

Apps: Hatnotes appear below paragraphs on many wikis
Closed, ResolvedPublic

Description

Steps to Reproduce

  1. Open https://it.wikipedia.org/api/rest_v1/page/mobile-html/Regno_Unito
  2. Compare to https://it.m.wikipedia.org/wiki/Regno_Unito
  3. Disambiguation hatnotes are not at the top of the page

Expected Results

Actual Results

Screenshot_20210316-114432_Wikipedia.jpg (2×1 px, 615 KB)

Environments Observed

  • itwiki

Additional notes

  • Android/iOS rely on hatnotes having the "hatnote" or "ambox" class, but this is not the case on many wikis (see parent task). As a result, lead paragraphs are hoisted above these hatnotes.

Event Timeline

cc @Daimona can you list any places that you are still seeing this issue?

cc @Daimona can you list any places that you are still seeing this issue?

Not right now, since the backport was deployed. A few broken places which I remember from the last time I checked:

  • It didn't work on itwiki (because the equivalents of {{hatnote}} and {{ambox}} use TemplateStyles, that is T277367)
  • {{redirect}} on frwiki didn't work (you've already fixed this 1 hour ago)

The other malfunctionings I saw on (fr|de|es)wiki were fixed by your edits on the 13th. I haven't checked any other wiki. I think checking what wikis are broken might be relatively easy to automate:

  • Get a list of localized templates from https://www.wikidata.org/wiki/Q5962027 and https://www.wikidata.org/wiki/Q5625128 (these lists should be processed separately)
  • For each wiki that is on a list, request https://lang.project.org/w/api.php?action=parse&format=json&title=Main%20page&text= + urlencode( '{{<LOCAL_NAME_OF_TEMPLATE>}}' )
  • Parse the resulting HTML like MoveLeadParagraphTransform does (skip style elements, verify whether the first element has "ambox" or "hatnote")

However, I think at this point it would make more sense to let communities fix what they want to. There might be additional templates, not included in Q5962027 or Q5625128, that might need to stay at the top for a certain project. Fixing everything now would likely make the JobQueue grow again.

Is this still being considered a train blocker?

No, sorry, that's just confusion over the task inheritance.

Jdlrobson renamed this task from Hatnotes appear below paragraphs on many wikis to Apps: Hatnotes appear below paragraphs on many wikis.Mar 16 2021, 6:43 PM
Jdlrobson updated the task description. (Show Details)

Change 676123 had a related patch set uploaded (by MSantos; author: MSantos):

[mediawiki/services/mobileapps@master] mobile-html: fix some hatnotes not being hoisted properly

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

Change 676123 merged by jenkins-bot:

[mediawiki/services/mobileapps@master] mobile-html: fix some hatnotes not being hoisted properly

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

As a note, <style> is not the only tag to be looking for from TemplateStyles, <link> may be interesting as well, which is the deduplicated TemplateStyle tag rendering (today).

E.g.,

{{hatnote|Content}}
{{hatnote|Content}}
Lorem ipsum dolor...

Will have rendering along the lines of

<style mw-id=ABC/>
<div class="hatnote">Content</div>
<link mw-points-to-id=ABC/>
<div class="hatnote">Content</div>
<p>...

Change 680370 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/services/mobileapps@master] Follow-up I939ba9828: Check for <link> tag as well as <style>

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

Nice catch @Izno! Thanks to you and @Esanders for the patch.

Change 680370 merged by jenkins-bot:

[mediawiki/services/mobileapps@master] Follow-up I939ba9828: Check for <link> tag as well as <style>

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

MSantos claimed this task.