Page MenuHomePhabricator

ToC: Build new ToC and create section links
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

This will be the first part of setting up the new, persistent version of the table of contents

Initial feature set

ToC visual design

Screen Shot 2022-01-05 at 10.26.46 AM.png (1×522 px, 105 KB)

elementLess CSS token
border style@border-base
border radius@border-radius-base
background color@background-color-base
Heading font size@font-size-heading-3 (Vector)
Link font size@font-size-base (Vector)
Top-level link color@color-primary
Sub-level link color@color-base
Sub-level indentation8px

Tokens are taken from wikimedia-ui-base unless specified otherwise.


Modified layout to accommodate new ToC
Screen Shot 2022-01-06 at 10.11.51 AM.png (1×2 px, 957 KB)
Screen Shot 2022-01-06 at 10.12.02 AM.png (1×2 px, 1021 KB)
current sidebar, 11.5em wide, grey backgroundnew sidebar, white background, ~14.5em wide
  • The sidebar area will have to be widened to fit the longer text of the new ToC.
  • The sidebar background colour should be changed to transparent to improve the transition between the ToC and sidebar.

Note: Narrow-width layout is TBD.

Open and closed states

The sidebar area should switch between showing the sidebar menu and the new table of contents.

Screen Shot 2022-01-06 at 10.52.22 AM.png (1×2 px, 678 KB)
Screen Shot 2022-01-06 at 10.45.31 AM.png (1×2 px, 672 KB)
sidebar opensidebar closed
Prototype of final version

https://di-toc-phase2.web.app/Hokusai

No ToC state

For pages that do not have a sidebar, such as main page & special pages, the content should be centered and the sidebar width should remain 14.5em when the sidebar is open.

Screen Shot 2022-01-06 at 12.21.56 PM.png (1×2 px, 1 MB)
Screen Shot 2022-01-06 at 12.21.48 PM.png (1×2 px, 1 MB)
no ToC, sidebar closedno ToC, sidebar open
Accessibility & semantic considerations
  • The new ToC should be accessible via keyboards and assistive technologies.
  • In the accessibility tree, the ToC should be a labeled as a navigational landmark
  • It should be a <nav> element

At this stage the feature should be feature-flagged and off by default.

With the work done in T287767, it's now possible to render the table of contents outside the parser content area via mustache templates.

Acceptance criteria

  • Allow the table of contents to appear persistently on the left side of the page
  • Allow the table of contents to contain links that navigate to the corresponding section within the ToC
NOTE: this tasks assumes that all sections within the ToC are uncollapsed.

Developer notes

You can use array-sections inside the Mustache template to render table of contents. How to do this is demonstrated in https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/737504

QA Results - Beta

ACStatusDetails
1T297611#7687626
2T297611#7687626

QA Results - Prod

ACStatusDetails
1T297611#7687630
2T297611#7687630

Event Timeline

ovasileva renamed this task from Build new ToC and create section links to ToC: Build new ToC and create section links.Dec 13 2021, 2:42 PM
ovasileva triaged this task as Medium priority.
Jdrewniak updated the task description. (Show Details)
Jdrewniak subscribed.
Jdlrobson raised the priority of this task from Medium to High.Jan 7 2022, 6:31 PM

Change 753127 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] Use 'toc' skin option and render with new TableOfContents mustache template

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

bwang removed bwang as the assignee of this task.Jan 13 2022, 5:41 PM
bwang moved this task from Doing to Code Review on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
bwang subscribed.

Test wiki created on Patch demo by BWang (WMF) using patch(es) linked to this task:

https://patchdemo.wmflabs.org/wikis/6b079bb77f/w/

Change 753127 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Use 'toc' skin option and render with new TableOfContents mustache template

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

Test Result - Beta

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

Test Artifact(s):

QA Steps

✅ AC1: Allow the table of contents to appear persistently on the left side of the page
✅ AC2: Allow the table of contents to contain links that navigate to the corresponding section within the ToC

Screen Recording 2022-02-06 at 6.20.46 PM.mov.gif (868×1 px, 3 MB)

Test Result - Prod

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

Test Artifact(s):

QA Steps

✅ AC1: Allow the table of contents to appear persistently on the left side of the page
✅ AC2: Allow the table of contents to contain links that navigate to the corresponding section within the ToC

Screen Recording 2022-02-06 at 6.27.03 PM.mov.gif (868×1 px, 1 MB)

Test wiki on Patch demo by BWang (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/6b079bb77f/w/