Page MenuHomePhabricator

Table of contents not show on desktop Minerva (remove wgMinervaTocEnabled config flag)
Closed, ResolvedPublic2 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:


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

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 14 2018, 4:27 PM
ovasileva triaged this task as Normal 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

TheDJ added a subscriber: TheDJ.Mar 23 2018, 3:14 PM

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

Jdlrobson updated the task description. (Show Details)Mar 27 2018, 3:32 PM
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 bug.
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
ovasileva set the point value for this task to 2.Mar 27 2018, 4:28 PM
Niedzielski moved this task from To Do to Doing on the Readers-Web-Kanbanana-Board-Old board.

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

Niedzielski removed Niedzielski as the assignee of this task.Mar 28 2018, 6:49 PM
Niedzielski added a subscriber: Niedzielski.

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

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

ovasileva updated the task description. (Show Details)Apr 2 2018, 10:19 AM
ovasileva closed this task as Resolved.Apr 4 2018, 10:36 AM
ovasileva added a subscriber: ovasileva.

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

@ovasileva yea I agree — we started discussing that here T189688#4097695