Page MenuHomePhabricator

[ToC] Show new/modified sections after publishing an edit (new floating ToC)
Closed, ResolvedPublic8 Estimated Story Points

Description

Description

When using Vector 2022, if you add a new section or modify an existing section heading of an article, and then publish your edit, the table of contents will not reflect the changes you've made. This issue affects both Visual Editor, and the 2017 Wikitext editor (which is based on VE).

Steps to reproduce:

  • open an article in edit mode (using either the Visual Editor or the 2017 wikitext editor)
  • add a new section
  • modify an existing section heading
  • publish
  • look at the table of contents...it does not show the new section you added, or the modified section heading

TODO

  • Make the updated table of contents display after an edit.
  • New frontend code has Jest unit tests

Sign off steps

  • Make sure jest tests were added

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Jdlrobson set the point value for this task to 8.Jun 6 2022, 5:32 PM

Hey @cscott is this task still blocked on you or do you need input from someone else e.g. my team or Daniel? Who is responsible for merging https://gerrit.wikimedia.org/r/c/mediawiki/core/+/802678 ?

I think this part of the task can be unblocked, as we've got some consensus around the ParserOutput portion of the task I think. We need a patch which sets the ParserOptions flag to finish the work on T307691, and I've got an initial version here: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/805897

Thanks @cscott! I've reassigned to editing team who we're meeting tomorrow.
Once https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/802680 is merged, web team can pick up https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/802676 (which does solve the issue as is but requires some thought from our side about loading Mustache on the client) and finish this up.

Jdlrobson updated Other Assignee, added: Jdrewniak.

Talked to Mo today and suggested this would be a good one for him to pick up next. Since it's an X-Large I suggested he pair with Jan on this one. We need to review the implications of adding Mustache to the client and consider alternatives to https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/802676.

There is handful of user scripts that update the page content without full reload, sometimes adding new sections: Convenient-Discussions, QuickEdit. I'm sure you will take care of Visual Editor and DiscussionTools, but what will be the mechanism that other tools could use to initiate the TOC re-rendering? If it's not automatic on mw.hook('wikipage.content').fire(), of course. (But this is often used outside #mw-content-text, to make scripts run on some content. And theoretically some tools could update not the whole #mw-content-text but a part of it.)

The mechanism I proposed would be usable by any user script etc. as well. You'd add &prop=sections to your action=parse API request, then pass a part of the result to mw.hook( 'wikipage.tableOfContents' ).fire( … ). You can see the implementation for the core MediaWiki live preview in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/802679/8/resources/src/mediawiki.page.preview.js.

Jdlrobson lowered the priority of this task from High to Medium.Jul 6 2022, 4:43 PM

We're targetting the week of 8th August to have this wrapped up so lowering priority.

Change 811829 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

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

Change 811830 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/core@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

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

Change 811831 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/extensions/VisualEditor@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

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

Change 812915 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

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

Change 812915 abandoned by Mabualruz:

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

Reason:

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

ovasileva raised the priority of this task from Medium to High.Jul 25 2022, 5:28 PM

Almost done with client side template rendering solution, it will be in review by tomorrow

Change 811831 abandoned by Mabualruz:

[mediawiki/extensions/VisualEditor@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

Reason:

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

Change 811830 abandoned by Mabualruz:

[mediawiki/core@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

Reason:

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

Change 811829 abandoned by Mabualruz:

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC) POC #1

Reason:

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

Change 821748 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC)

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

Mabualruz added a subscriber: Mabualruz.

Change 821748 merged by jenkins-bot:

[mediawiki/skins/Vector@master] [ToC] Show new/modified sections after publishing an edit (new floating ToC)

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

Jdlrobson updated the task description. (Show Details)

@Mabualruz I'm moving this to QA so we can get a headstart on testing, but the unit tests should be considered a blocker for resolving this ticket as discussed.

Looking good for me on test.wiki. Moving to QA in Prod

Example Article with TOC - https://test.wikipedia.org/wiki/Wikipedia:Village_pump

Screen Shot 2022-08-17 at 8.41.23 AM.png (1×2 px, 650 KB)

Screen Shot 2022-08-17 at 11.38.24 AM.png (1×2 px, 1018 KB)

Screen Shot 2022-08-17 at 11.29.31 AM.png (1×2 px, 1 MB)

Screen Shot 2022-08-17 at 11.53.24 AM.png (1×2 px, 1 MB)

Screen Shot 2022-08-17 at 11.55.14 AM.png (1×2 px, 1 MB)

Screen Shot 2022-08-15 at 3.47.12 PM.png (1×2 px, 2 MB)

Change 802676 abandoned by Bartosz Dziewoński:

[mediawiki/skins/Vector@master] Handle new 'wikipage.tableOfContents' hook to update TOC dynamically

Reason:

Superseded by https://gerrit.wikimedia.org/r/821748

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

There are issues with the current version when editing using visual editor:

  • If headings are added to an article that previously had less than 4, the TOC should be shown, but it isn't (until you reload the page)
  • If headings are removed from an article that previously had at least 4, the TOC should be hidden, but it isn't (until you reload the page)

There are issues with the current version when editing using visual editor:

  • If headings are added to an article that previously had less than 4, the TOC should be shown, but it isn't (until you reload the page)
  • If headings are removed from an article that previously had at least 4, the TOC should be hidden, but it isn't (until you reload the page)

Has there been a discussion among designers / general public as to whether there is a need to hide the sidebar TOC when there is less than 4 sections? It would seem to me that since the TOC is not part of the content anymore, there is no reason to fine-tune its presence in such a way.

Not that I know of, but I don't think this matters here. The bug also occurs when the table of contents is forced on or off using __TOC__ / __NOTOC__ magic words, or in visual editor's page options:

image.png (2×3 px, 1 MB)

This comment has been deleted.

I've opened T315862 and T315863 for the two remaining issues. Let's continue conversation on relevant tickets.

And current section highlighting doesn't work as well: T316037.

Confirming this works now on pilot wikis, not including the bugs tracked in T316033: Table of contents toggles don't work correctly after update, T316037: Current section highlighting in TOC doesn't work after update and elsewhere. Will need to be reassigned to check the jest tests

Jdlrobson claimed this task.

Confirming this works now on pilot wikis, not including the bugs tracked in T316033: Table of contents toggles don't work correctly after update, T316037: Current section highlighting in TOC doesn't work after update and elsewhere. Will need to be reassigned to check the jest tests

I've split this out into T316571. It's not done but important.