The MobileFormatter:prepareHeadings method is over-zealous about which headings are collapsible. This could be leading to various edge cases where headings work inappropriately resulting in strange UI's being exposed to our readers.
Suggested implementation
As @TheDJ suggests this could be remedied by a refactor of MobileFormatter::makeSections.
- Repurpose prepareHeadings to prepareHeading
- Before inserting sectionBody a call to prepareHeading should be run on the $node (the heading)
Acceptance Criteria
- Add a test to capture the example in https://en.m.wikipedia.beta.wmflabs.org/wiki/Headings_in_infobox - expected behaviour is that the heading inside the infobox should not have 'section-heading' class or an onlick event.
- In certain cases no headings should be transformed, for example any headings inside a div e.g. "Off the beaten path" in this example should be left untouched.
Headings_in_infobox:60 Uncaught TypeError: Cannot read property 'className' of null(…)
Sign off notes
- Update T130898 to reflect any changes as a result of this work