Page MenuHomePhabricator

Table of contents doesn't respect NOTOC after an edit
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to ____
  • Add __NOTOC__ to the page and hit save

What happens?:
Expected: table of contents disappears

What should have happened instead?:
Actual: table of contents reappears. After reloading the page it disappears.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

QA Results - Beta

ACStatusDetails
1T315863#8196907
2T315863#8196907

QA Results - Prod

ACStatusDetails
1T315863#8203277
2T315863#8203277

Event Timeline

Jdlrobson added a subscriber: matmarex.

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)

Presumably our wikipage.tableOfContents hook should not fire in the case of NOTOC (https://gerrit.wikimedia.org/g/mediawiki/core/+/c7099b957afae584dfdd4c2a0c814ca847bd4763/resources/src/mediawiki.page.preview.js#179). Can we get the value of the NOTOC flag from the parser result?

Presumably our wikipage.tableOfContents hook should not fire in the case of NOTOC (https://gerrit.wikimedia.org/g/mediawiki/core/+/c7099b957afae584dfdd4c2a0c814ca847bd4763/resources/src/mediawiki.page.preview.js#179). Can we get the value of the NOTOC flag from the parser result?

Yes and yes, it already does that. See the check for response.parse.hidetoc in the code you linked to. wikipage.tableOfContents is fired with an empty array if the TOC is not supposed to be displayed, but Vector still displays an empty TOC with a "Beginning" link.

Jdlrobson renamed this task from Table of contents doesn't respect NOTOC to Table of contents doesn't respect NOTOC after an edit.Aug 23 2022, 5:27 PM

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

[mediawiki/skins/Vector@master] Table of contents doesn't respect NOTOC after an edit

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

Change 826551 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Table of contents doesn't respect NOTOC after an edit

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

LGoto set the point value for this task to 3.Aug 29 2022, 5:46 PM

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Edit the source of an article
Add NOTOC to the page and hit save
✅ AC1: The table of contents disappears
Remove NOTOC
✅ AC2: The table of contents reappears

Screen Recording 2022-08-29 at 6.58.12 PM.mov.gif (898×1 px, 3 MB)

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Edit the source of an article
Add NOTOC to the page and hit save
✅ AC1: The table of contents disappears

Remove NOTOC
✅ AC2: The table of contents reappears

Screen Recording 2022-08-31 at 9.43.21 AM.mov.gif (966×1 px, 3 MB)