Page MenuHomePhabricator

[Bug] Table of contents duplicating ids, breaking hash behaviour
Closed, InvalidPublic

Description

Steps to Reproduce

  1. Visit https://en.m.wikipedia.org/wiki/Ulaanbaatar#Names_and_etymology
  2. Click Names and etymology

Expected Results

  • Taken to "Names and etymology" section

Actual Results

  • Taken to link in table of contents

Environments Observed

  • Chrome

Testing Environment for QA

beta cluster

Browser Version

OS Version

Device Model

Device Language

Developer notes

Inspecting the table of contents HTML the toc item is rendered like so:

<li>
       <a href="#Names_and_etymology"><span id="Names_and_etymology"></span>Names and etymology</a>
       <ul>
       </ul>
</li>

Expected - the span id should not be present.
Should be possible to create a QUnit test to check for this and make sure HTML with ids is not printed in the table of contents.

Event Timeline

It sounds like the causes are different but T193926 is topically similar.

@Niedzielski indeed. The table of contents shouldn't render in mobile, but if for any reason it does, yes it might make it ambiguous to where to scroll to. However, this one is clear - the HTML is rendered twice. Something similar may be happening in T193926 but would likely be a different code path.

The heading wikitext contains an anchor with the same text as the title which is breaking the mobile TOC.

=={{anchor|Names and etymology}}Names and etymology==

The template is quite widely used: https://en.m.wikipedia.org/wiki/Template:Anchor but this seems to be an inappropriate use of this template as it results in invalid HTML (multiple IDs)

Vvjjkkii renamed this task from [Bug] Table of contents duplicating ids, breaking hash behaviour to rvdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Vachovec1 renamed this task from rvdaaaaaaa to [Bug] Table of contents duplicating ids, breaking hash behaviour.Jul 1 2018, 6:11 PM
Vachovec1 closed this task as Invalid.
Vachovec1 lowered the priority of this task from High to Medium.
Vachovec1 updated the task description. (Show Details)