Page MenuHomePhabricator

[ToC] table of contents in Edit mode
Open, MediumPublic

Description

Description

We are moving the table of contents to the side of the article text, and making it sticky (i.e. it stays in place as your scroll down the page). Currently our plan is to only do this for pages in the main namespace, in read mode. Assuming people frequently go from read mode to edit mode, it might make sense to consider this transition, in particular thinking about the visual balance/layout of the page changes between the two as major elements shift around.

NOTE: this is a similar task as T294784, but it's about edit mode instead of talk pages

Questions to answer

Do we want to show the table of contents in edit mode?

If yes:

  • what are the technical, design, and product considerations we need to think through?

If no:

  • what do we prefer?
    • that space is empty
      • re-center page
      • don't re-recenter page
    • that space is occupied by some other element
    • that space is used to display the page full-width

Reference images

Event Timeline

ovasileva triaged this task as Medium priority.Nov 9 2021, 6:10 PM

Some initial thoughts/questions:

  • How might the topic containers interact with the TOC?
  • How do archived conversations interact with the TOC?
  • How do different types of contributors use the TOC on Talk pages?
  • Are TOC more useful on highly populated Talk pages?
  • Is this an area where we are intentionally syncing up with the Reading (article) view or going a different direction to differentiate the experiences even further?

It would be nice if the table of contents worked for both the visual and source editors. Right now it's enabled on both and doesn't work so it should probably be disabled temporarily.

It would be nice if the table of contents worked for both the visual and source editors. Right now it's enabled on both and doesn't work so it should probably be disabled temporarily.

@Lectrician1 - yes, this is a bug - we're disabling this in T307112: [Bug] Table of contents should not appear in edit mode

As an editor, I strongly want the ToC to be visible whilst I'm editing, so that I can see structural changes I have made reflected in the ToC, and also detect any errors before I save.
Not having access to the ToC is a primary reason I don't ever use the 2017 Wikitext Editor.
I filed this yesterday because I really want a ToC visible in the classic 2010 WikiEditor: T307256: ToC is not shown during Preview when using the standard WikiEditor

Change 802676 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

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

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

Change 802677 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] EditPage: Set sections for new skin TOC when previewing

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

Change 802678 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] ApiParse: When querying TOC sections, also return whether it should be shown

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

Change 802679 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Fire new 'wikipage.tableOfContents' hook to update TOC on live preview

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

Change 802680 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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

Change 802681 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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

matmarex subscribed.

The patches I'm proposing would cause the table of contents to be updated after previewing in old wikitext editor, and after saving in VisualEditor and DiscussionTools.

Change 800765 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] ParserOption/ParserOutput flag to suppress or hide the table of contents

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

Change 802677 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Set sections for new skin TOC when previewing

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

Change 802678 merged by jenkins-bot:

[mediawiki/core@master] ApiParse: When querying TOC sections, also return whether it should be hidden

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

Change 802680 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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

Change 802679 merged by jenkins-bot:

[mediawiki/core@master] Fire new 'wikipage.tableOfContents' hook to update TOC on live preview

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

Change 800765 merged by jenkins-bot:

[mediawiki/core@master] ParserOption/ParserOutput flag to suppress or hide the table of contents

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

Change 802681 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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

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

Note that ToC is currently shown in preview, but class vector-toc-visible is not added to .mw-page-container-inner any more. Hence layout might not be ready for the toc.

Described in full in T315610.

I only forgot to mention that I have enabled the option to show preview when editing (#mw-input-wppreviewonfirst; pl: "Pokazuj podgląd strony podczas pierwszej edycji").

A screen that is showing view with enhanced layout after workaround mentioned in T315610.

obraz.png (1×1 px, 260 KB)

Enhanced layout:
https://pl.wikipedia.org/wiki/Dyskusja_wikipedysty:Nux/Fixed_top_bar.css

@Jdlrobson @Nux I'm not sure whether T315610 is really a duplicate, however, the issue you described there (and in the comment here) looks fixed to me. If you can still reproduce it, please re-open that task.

@matmarex at the current time we intentionally do not show the table of contents in edit mode. This task is about adding it.

Recent work has been to show the table of contents after an edit ( T307251) and in preview mode but we haven't addressed the case of during an edit (and don't have plans to at the current time).

I know, but T315610 was not about this. T315610 was about the preview that occurs when you're using the "Show preview on first edit" preference.

I think this task has 5 parts:

  1. (regression) Display the Vector 2022 TOC while previewing in old wikitext editor – T307256
  2. (regression) Display the Vector 2022 TOC while previewing in old wikitext editor with live preview enabled – [no task]
  3. (regression) Display the Vector 2022 TOC while previewing in 2017 wikitext editor [no task]
  4. (new feature) Display the Vector 2022 TOC while editing in visual editor – [no task]
  5. (new feature) Display the Vector 2022 TOC while editing in 2017 wikitext editor [no task]

We (Editing-team) need to figure out which of the above we're going to work on, file subtasks for those, and close this task.

My work on this task so far (which should have been on subtasks too, but oh well) was only about 1 and 2, and I only worked on it because most of it was also needed to fix the behavior after publishing an edit (T307251).

Currently, 1 and 2 are already mostly working correctly, but nothing has been done on 3, 4 and 5.

This task needs to be increased in priority now that Vector 2022 is the default skin. Being unable to see the TOC when I click Edit on a long page means that I have to use Find or scrolling to navigate, both of which can be tedious and imprecise.

T307256 seems to have regressed? Perhaps as a result of the zebra work?

aegina.gif (188×509 px, 21 KB)

Assuming this is the same issue -- in the short term, should we hide the TOC icon when in edit mode, to avoid this confusing UX?