Page MenuHomePhabricator

Table of contents not show on desktop Minerva (remove wgMinervaTocEnabled config flag)
Closed, ResolvedPublic2 Estimated Story Points

Description

Compare https://en.wikipedia.org/wiki/Henry_VIII_of_England?useskin=minerva with https://en.m.wikipedia.org/wiki/Henry_VIII_of_England on a desktop device.

In the latter link a table of contents shows:

Screen Shot 2018-03-14 at 9.26.27 AM.png (260×809 px, 28 KB)

However in doesn't show in the former link (it should)

Acceptance criteria

  • The table of contents should be showing. Remove logic relating to wgMinervaTocEnabled

Developer notes

In Minerva, the table of contents is only rendered in JS if mw.config.get( 'wgMinervaTocEnabled' ) is true. The desktop table of contents is present in the document but hidden.

#toc { display:none; }

It has logic to deal with cases where the #toc is already in the document and when it is not but wgMinervaTocEnabled is stopping it!:

var enableToc = mw.config.get( 'wgMinervaTocEnabled' );
if ( enableToc ) {
			toc = new TableOfContents( {
				sections: sections
			} );

			// eslint-disable-next-line no-new
			new Toggler( toc.$el, 'toc-', null, true );
			// if there is a toc already, replace it
			if ( $toc.length > 0 ) {
				// don't show toc at end of page, when no sections there
				$toc.replaceWith( toc.$el );
			} else {
				// otherwise append it to the lead section
				toc.appendTo( page.getLeadSectionElement() );
			}
		}

I've reviewed the logic and the mw.config.get( 'wgMinervaTocEnabled' ) is not necessary anymore so remove all that logic.

Testing criteria

  1. Go to https://en.wikipedia.beta.wmflabs.org/wiki/African_wild_dog?useskin=minerva
  2. Ensure toc appears on the page
  3. Test on multiple browsers

Event Timeline

ovasileva triaged this task as Medium priority.Mar 15 2018, 3:44 PM

maybe a related issue, for https://en.m.wikipedia.org/wiki/Henry_VIII_of_England the Contents button/box is right below the first paragraph, whereas for https://en.m.wikipedia.org/wiki/Empire_of_Japan it's floating way down towards the bottom of the infobox

I'm confused. It shows just fine for me:

Screen Shot 2018-03-23 at 16.13.25.png (2×2 px, 1 MB)

Jdlrobson renamed this task from Table of contents not show on desktop Minerva to Table of contents not show on desktop Minerva (remove wgMinervaTocEnabled feature flag).Mar 27 2018, 3:38 PM
Jdlrobson added a project: good first task.
Jdlrobson updated the task description. (Show Details)
Jdlrobson renamed this task from Table of contents not show on desktop Minerva (remove wgMinervaTocEnabled feature flag) to Table of contents not show on desktop Minerva (remove wgMinervaTocEnabled config flag).Mar 27 2018, 4:26 PM

Change 422463 had a related patch set uploaded (by Niedzielski; owner: Stephen Niedzielski):
[mediawiki/skins/MinervaNeue@master] Fix: always show table of contents

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

Change 422463 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Fix: always show table of contents

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

ovasileva subscribed.

Looks good to me! @alexhollender - I wonder if we've considered uncollapsing the TOC by default beyond a certain screen size?