Page MenuHomePhabricator

ToC: Build feature flag and url parameter for the table of contents
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

We would like to begin building the table of contents by setting up a feature flag and url parameter that will allows us to display the persistent version of the table of contents

Acceptance criteria

  • Build feature flag for the table of contents that turns the new version of the ToC on and off
  • Build url parameter for the table of contents
  • When the feature flag is enabled the table of contents should not appear in the article body (this can be achieving by setting the skin option "toc" to false in the constructor of SkinVector
  • Do not call the skin version code in the constructor. This is not possible to do in production. It should be possible to set inside SkinVector::generateHTML if necessary

QA steps

  • If testing locally, navigate to an article page (not using content provider) that has an existing Table of Contents (if a locally created page has headings, you can place __TOC__ in edit source to get the inline (in the body) TOC).
  • Test the following configuration:
$wgVectorTableOfContents = [
	"default" => true
];
  • When true, you should see the body TOC disappear and the following markup in the sidebar:

Screen Shot 2021-12-16 at 5.01.22 PM.png (624×2 px, 232 KB)

  • When false, you should see the body TOC and no TOC markup in the sidebar
  • Test query param by setting default to false and adding ?tableofcontents=1 - you should see body TOC disappear and sticky TOC markup appear.
  • Test legacy Vector blowing up when setting default to true or setting query params ?useskinversion=1&tableofcontents=1

QA Results - Beta

ACStatusDetails
1T297610#7726936
2T297610#7726936
3T297610#7726936

QA Results - Prod

ACStatusDetails
1T297610#7726939
2T297610#7726939
3T297610#7726939 this is a pass per T297610#7729312

Event Timeline

I think it's pretty clear to us at this point how to setup feature flagging so moving to "ToDo".

The thing that's not clear to me is how to do this safely giving the skin versioning code cannot be used in the Skin constructor and modern and legacy Vector share the same code. It's possible T291098 may need to be prioritized or we may need to live with 2 table of contents temporarily in the HTML markup.

Change 747199 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/skins/Vector@master] Add feature flag for sticky table of contents

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

cjming moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
cjming subscribed.

Change 747558 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Disable table of contents in article body

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

Change 747199 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Add feature flag for sticky table of contents

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

cjming updated the task description. (Show Details)
cjming updated the task description. (Show Details)
cjming moved this task from Code Review to QA on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.

Change 747558 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Disable table of contents in article body

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

Test Result - Beta

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

Test Artifact(s):

QA Steps

✅ AC1: When false, you should see the body TOC and no TOC markup in the sidebar

Screen Recording 2022-02-21 at 6.26.29 PM.mov.gif (1×1 px, 760 KB)

✅ AC2: Test query param by setting default to false and adding ?tableofcontents=1 - you should see body TOC disappear and sticky TOC markup appear.

Screen Recording 2022-02-21 at 6.36.30 PM.mov.gif (1×1 px, 2 MB)

✅ AC3: Test legacy Vector blowing up when setting default to true or setting query params ?useskinversion=1&tableofcontents=1
This didn't blow up, so I'm assuming it passed.

Screen Recording 2022-02-21 at 6.31.18 PM.mov.gif (1×1 px, 1 MB)

Edtadros subscribed.

Test Result - Prod

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

Test Artifact(s):

QA Steps

✅ AC1: When false, you should see the body TOC and no TOC markup in the sidebar
I also tried this with ?tableofcontents=0, but I'm not sure that is the same as setting the default to false locally

Screen Recording 2022-02-21 at 6.40.39 PM.mov.gif (1×1 px, 871 KB)

✅ AC2: Test query param by setting default to false and adding ?tableofcontents=1 - you should see body TOC disappear and sticky TOC markup appear.

Screen Recording 2022-02-21 at 6.42.31 PM.mov.gif (1×1 px, 2 MB)

❌ AC3: Test legacy Vector blowing up when setting default to true or setting query params ?useskinversion=1&tableofcontents=1
@cjming, In beta the params didn't break, but in prod we do get an exception. Is this in prod yet? Also, is the test in beta valid?

Screen Recording 2022-02-21 at 6.43.57 PM.mov.gif (1×1 px, 513 KB)

hi @Edtadros I would consider AC3 a pass -- it definitely breaks in prod in legacy vector which it's supposed to:

https://en.wikipedia.org/wiki/Barack_Obama?tableofcontents=1

Screen Shot 2022-02-22 at 10.46.33 AM.png (622×1 px, 113 KB)

I'm not sure why it doesn't break in beta i.e. https://en.wikipedia.beta.wmflabs.org/wiki/Barack_Obama?useskin=vector&tableofcontents=1. I'll see if I can sleuth for an answer but in the meantime if it passes in prod, presumably it's gtg?