Page MenuHomePhabricator

[Minerva TOC] All sections are always expanded
Closed, ResolvedPublic3 Estimated Story Points

Description

User story

As a mobile user with easy access to a table of contents, I have no use for collapsed sections and would much rather have all content at my disposal right away.

Requirements

Sections should be expanded from the start, with no delay or FOUC, and should not even be collapsible anymore.
Minerva comes with pre-existing support for this through $wgMFNamespacesWithoutCollapsibleSections, but its Parsoid implementation does not respect/support that.
I would suggest to simply force usage of the legacy parser for this experiment, and not bother updating Minerva until the experiment proves successful.

Update

T407815: Section collapsing applies to namespaces it should not apply to in mobile makes Parsoid honor $wgMFNamespacesWithoutCollapsibleSections, so we can support both parsers.

Acceptance criteria

  • Page sections are expanded from the start
  • There is no delay or FOUC
  • Sections can no longer be collapsed on the legacy parser
  • Sections can no longer be collapsed on Parsoid

Event Timeline

mfossati changed the task status from Open to In Progress.Jan 7 2026, 3:27 PM
mfossati claimed this task.

FYI - The AC is done if not using Parsoid

@mfossati - This task T407815 in the current sprint is related because it handles the collapsible section behavior using the $wgMFNamespacesWithoutCollapsibleSections global in MobileFrontend. The bug exists when Parsiod is enabled. Parsoid doesn't respect the global, and my patch should fix that. Legacy parser already works as expected and respects the global.

For T413404, you can add the "Main" namespace (number 0) to the list in extension.json, which appears to work.

"MFNamespacesWithoutCollapsibleSections": {
			"value": [
				6,
				14,
				-1,
				-2,
				0
			]
		},

Following https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1219599?usp=search you can add the class mf-collapsible-sections-disabled and remove mf-collapsible-sections from the BODY tag to trigger this behaviour. This could live inside a https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBeforeHTML hook in ReaderExperiments.

Change #1227749 had a related patch set uploaded (by Marco Fossati; author: Marco Fossati):

[mediawiki/extensions/ReaderExperiments@master] Minerva TOC: don't force the legacy parser

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

Note: I don't think that (at least) the Parsoid side of things will work with MobileFrontendContentProvider, as MFNamespacesWithoutCollapsibleSections will have a different configuration on production than it will be on the wiki using MFCP, and so the content will be rendered differently.
I confirmed with locally-rendered Parsoid pages that it works, though.

Change #1227749 merged by jenkins-bot:

[mediawiki/extensions/ReaderExperiments@master] Minerva TOC: don't force the legacy parser

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

Following https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/1219599?usp=search you can add the class mf-collapsible-sections-disabled and remove mf-collapsible-sections from the BODY tag to trigger this behaviour. This could live inside a https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBeforeHTML hook in ReaderExperiments.

Is the plan to set $wgMFNamespacesWithoutCollapsibleSections = [0] for all users in the experiment? That would also work (assuming test kitchen can do that!)

@matthiasmullie, @mfossati - checked the desktop Mobile view and the real mobile device and got different results. Could it be that I misunderstood the requirements?

Checked on wmf.12 and enwiki beta. Checked for anon users, logged-in users with different settings for "Use the new Parsoid wikitext parser".

(1) desktop Mobile view - all specs are in place

  • go to a random article - make sure that Mobile view is clicked
  • an article displays all section expanded

(2) real mobile device (or use a browser mobile emulator) - sections are displayed collapsed

  • go to a random article
  • all sections are collapsed

Note:
On browser emulator:

  • Switching to a different width and reload - i.e. a mobile phone -> ipad - makes the sections extend:
    • on a mobile with width ~412 px (browser emulator) - the sections are collapsed
    • switch to ipad/kindle ~800 px, reload -> the setions get extended

Revert steps on the above scenario (i.e. switching from ipad-like 800px to a mobile phone) - the sections will collapse.

  • Switching to Minerva skin in User preferences - all sections are displayed expanded.
    • a desktop user switches to Minerva in User preferences
    • goes to a random article - all sections are expanded
    • switch to a mobile phone (~412px) and reload
    • the sections are still displayed extended.

@Etonkovidova This is not enabled by default - it's part of the Minerva TOC experiment, which can be triggered through ?mpo=minerva-toc-button:treatment and ?mpo=minerva-toc-sticky:treatment. My apologies for not making that clear!

@Jdlrobson-WMF That is indeed the plan. Instead of config, it's being set in one of the early hooks (before MobileFrontend actually uses it) so that we're able to check whether conditions (correct skin & part of experiment group) are met. See https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/ReaderExperiments/+/refs/heads/wmf/1.46.0-wmf.13/src/Hooks.php#162

@Etonkovidova This is not enabled by default - it's part of the Minerva TOC experiment, which can be triggered through ?mpo=minerva-toc-button:treatment and ?mpo=minerva-toc-sticky:treatment. My apologies for not making that clear!

Thank you, @matthiasmullie! I did not realize that it's A/B experiment.

Re-checking for ?mpo=minerva-toc-button:treatment and ?mpo=minerva-toc-sticky:treatment on enwiki wmf.12.

The scope of this task is done; I've marked the specs as complete.

Note:
Filed T415794: [QA Task] testing TOC - minerva-toc-sticky - mostly to document the current state of TOC with minerva-toc-sticky.