Page MenuHomePhabricator

When editing via VisualEditor Wrong style of Table of Contents displays when saving a page at Wikivoyage
Closed, ResolvedPublic8 Estimated Story Points

Description

Steps to reproduce:

  1. Go to https://en.wikivoyage.beta.wmflabs.org/wiki/Tokushima
  2. Note the Table of Contents, which is in the banner image at the top.
  3. Open the page in VisualEditor and make a change.
  4. Save the page, and note that the MediaWiki default TOC has appeared.

Workaround: Reload the page to make the extra TOC disappear.

Before edit:

Screen Shot 2017-05-24 at 8.04.23 AM.png (622×1 px, 584 KB)

After edit:

Screen Shot 2017-05-24 at 8.03.58 AM.png (636×1 px, 602 KB)

Event Timeline

Whatamidoing-WMF raised the priority of this task from to Low.
Whatamidoing-WMF updated the task description. (Show Details)

No, because I also reproduced on Safari on an Air. FTR in the Misc tab of my Prefs there I only have "Floated table of contents" selected.

Im somewhat hopeful T130632 will fix this.

Change 355274 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/WikidataPageBanner@master] Use ParserOutput::setTOCEnabled instead of OutputPage::enableTOC

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

Im somewhat hopeful T130632 will fix this.

Change 355274 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/WikidataPageBanner@master] Use ParserOutput::setTOCEnabled instead of OutputPage::enableTOC

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

Indeed. T130632 moves the logic of loading mediawiki.toc from Parser to Skin. It also removes support to toggle TOC via OutputPage. Instead, this should happen via ParserOutput directly (via the same hook). This way it will also be considered by EditPage Preview, Live Preview, and the Parse API –  which is what Parsoid and VisualEditor use.

I can also replicate this now.

The database is locked at the moment, so I can't replicate the bug on labs by importing to https://en.wikivoyage.beta.wmflabs.org/wiki/Tokushima?action=edit
I want to do this before merging the patch.

Change 355274 merged by jenkins-bot:
[mediawiki/extensions/WikidataPageBanner@master] Use ParserOutput::setTOCEnabled instead of OutputPage::enableTOC

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

This still appears to be an issue and I think the issue lies in VisualEditor.
The toc appears in the response from the save API inside visualeditoredit.content
It's possible that either

  1. VisualEditor's API is making an assumption about the table of contents being there and adding it itself
  2. The VisualEditor response is not honoring the onOutputPageParserOutput hook which can make modifications to the ParserOutput.
  3. WikidataPageBanner needs to use another hook provided by VisualEditor

VisualEditor team please advise.

Jdlrobson renamed this task from Wrong style of Table of Contents displays when saving a page at Wikivoyage to When editing via VisualEditor Wrong style of Table of Contents displays when saving a page at Wikivoyage.May 24 2017, 2:59 PM
Jdlrobson raised the priority of this task from Low to Medium.
Jdlrobson updated the task description. (Show Details)

(I can't actually reproduce on that test wiki because apparently the VEdit isn't happening - I'm logged out, and it actually appears in the history, but the Save dialog won't close. Stuff for a different ticket though - T166254)

Jdforrester-WMF assigned this task to Krinkle.
Jdforrester-WMF set the point value for this task to 8.
Jdforrester-WMF moved this task from Freezer to External and Administrivia on the VisualEditor board.

Not sure why this was resolved... it's still an issue that can be easily reproduced with production steps.
See https://phabricator.wikimedia.org/T126361#3289173

The fix for this was the same as for mediawiki.toc loading in MobileFrontend and depends on a 5-patch stack in MediaWiki core - which was merged after the branch cut this week, so it'll roll out next week.

Can you reproduce it in beta?

Change 355274 merged by jenkins-bot:
[mediawiki/extensions/WikidataPageBanner@master] Use ParserOutput::setTOCEnabled instead of OutputPage::enableTOC

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

@ReleaseTaggerBot added a project: MW-1.30-release-notes (WMF-deploy-2017-05-30_(1.30.0-wmf.3))

Yes. This relates to the HTML not the resource loader module. VisualEditor seems to re-render the page in JavaScript so there's probably still a bug somewhere. Try editing https://en.wikivoyage.beta.wmflabs.org/wiki/Tokushima and following the steps in the description to see this.

Okay I stand corrected. It must have been a caching problem relating to old cached HTML before the changes were merged, I can no longer replicate it on that page. Sorry to be a bother but good to know this bug may stay a little while on cached pages!