Page MenuHomePhabricator

When editing via VisualEditor Wrong style of Table of Contents displays when saving a page at Wikivoyage
Closed, ResolvedPublic8 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:

After edit:

Event Timeline

Whatamidoing-WMF raised the priority of this task from to Low.
Whatamidoing-WMF updated the task description. (Show Details)
Whatamidoing-WMF added a project: VisualEditor.
Whatamidoing-WMF added a subscriber: Whatamidoing-WMF.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 9 2016, 7:15 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptFeb 9 2016, 8:04 PM
Jdlrobson added a subscriber: Jdlrobson.

I cannot reproduce this.

I can:

Perhaps it's Firefox only?

Elitre added a subscriber: Elitre.EditedMay 17 2017, 3:07 PM

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.

Jdlrobson updated the task description. (Show Details)May 23 2017, 9:56 PM

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 Normal.
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)May 24 2017, 3:04 PM
Elitre added a comment.EditedMay 24 2017, 7:30 PM

(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 closed this task as Resolved.May 25 2017, 11:25 AM
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.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMay 25 2017, 11:25 AM
Jdlrobson reopened this task as Open.May 25 2017, 5:21 PM

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

Krinkle added a comment.EditedMay 25 2017, 6:42 PM

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.

Jdlrobson closed this task as Resolved.May 25 2017, 6:46 PM

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!