Page MenuHomePhabricator

[Truncation] Collapse infoboxes into a Quick Facts section
Closed, ResolvedPublic3 Estimated Story Points

Description

Extract the lead infoboxes into a collapsible "Quick facts" section and position them after the lead on all screen widths (inspired by Wikipedia Apps). Part of the rationale for this experiment is that long infoboxes push the lead text down the page on narrow screens.

  • Extract the infobox in PHP and add additional section
  • Minerva breakpoint ~640px
  • Out of scope: Minimal Minerva page chips

Design

Requirements

  • A new section heading "Quick facts" appears as the first section heading.
  • All infoboxes in the lead section are moved into this new section, centered and full screen with a max width. Please test on pages with 2 infoboxes such as California to make sure both are moved.
  • Infoboxes outside the lead will not be moved.
  • The experience will be identical for tablet and mobile users
  • The Quick facts section will be expanded by default if the user has selected "Expand all sections" in settings (Special:MobileOptions).
  • Quick facts is expanded by default on wide screens similar to other sections.
  • Quick facts is collapsed by default on narrow screens.
  • Quick facts works on wikis that run on Parsoid and legacy parser (eg. zhwiki).

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
HSwan-WMF set the point value for this task to 3.
mfossati renamed this task from [Truncation UI] Collapse infoboxes into a Quick Facts section to [Truncation] Collapse infoboxes into a Quick Facts section.Jul 22 2026, 2:31 PM
mfossati lowered the priority of this task from High to Medium.Jul 22 2026, 3:44 PM
mfossati edited projects, added: ReaderExperiments-MinMin; removed: ReaderExperiments.
etz raised the priority of this task from Medium to High.Jul 22 2026, 4:11 PM
SherryYang-WMF lowered the priority of this task from High to Low.Thu, Aug 13, 10:56 PM

Change #1327231 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/skins/MinervaNeue@master] Quick facts: move the lead infobox into a collapsible section

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

Addressing Jon's feedback in Gerrit to move the code from Minerva to MobileFrontend repo.

Change #1327231 abandoned by LWatson:

[mediawiki/skins/MinervaNeue@master] Quick facts: move the lead infobox into a collapsible section

Reason:

move code from MinervaNeue to MobileFrontend

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

Change #1329404 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] Quick facts: move the lead infobox into a collapsible section

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

Ready for code review! This task will be carried over into a new sprint for code review.

Jenkin CI checks pass. Earlier the builds failed because the new file, src/mobile.quickFacts/quickFacts.js wasn't covered in OwnersStructureTest. Resolved by documenting it in OWNERS.md, and now the builds succeed.

Notes:

  • Sherry mentioned task T421116 because it shows that there's interest in bringing "quick facts" to mobile web.
  • Enable quick facts in LocalSettings.php: $wgMFQuickFacts = [ 'base' => true ];
  • [TODO] QA Steps
lwatson changed the point value for this task from 3 to 1.Wed, Aug 26, 4:30 PM

Change #1332498 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] [POC] Quick facts: move infobox into a collapsible section on all screen widths

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

Moved this task back to "doing" to confirm the requirements with design.

Proposal to change the screen width requirement from narrow-width to all screen widths: https://docs.google.com/document/d/1NsqXIVR1Fdn3y4mrCmVma8M5CsT4uZSHNXvoePTMZic/edit?tab=t.0#heading=h.kuynuqh3jxqw

confirming the following from our discussion in Slack:

  • A new section heading "Quick facts" appears as the first section heading.
  • All infoboxes in the lead section are moved into this new section (I assume infoboxes outside the lead will not be moved and display as before?), centered and full screen with a max width. Please test on pages with 2 infoboxes such as California to make sure both are moved.
  • The experience will be identical for tablet and mobile users
  • The Quick facts section will be expanded by default if the user has selected "Expand all sections" in settings

Change #1329404 abandoned by LWatson:

[mediawiki/extensions/MobileFrontend@master] Quick facts: move the lead infobox into a collapsible section on narrow screens

Reason:

abandon in favor of I49b2ce4aa20bcafbd1a376487d8a3470aea7c500

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

lwatson changed the task status from Open to In Progress.Wed, Sep 2, 1:30 PM
lwatson updated the task description. (Show Details)

Ready for code review! Here's the patchdemo link to preview the change: https://quick-facts-all-screen-widths-v2-b9cd5b357748.catalyst.wmcloud.org/wiki/California?useformat=mobile&quickfacts=1

Edge case: articles with multiple infoboxes in the lead section
Tested the edge case using the California article which has two infoboxes.
Applied 32px spacing between the lead infoboxes.

quickFacts_California_multiline_caption.png (1,478×526 px, 57 KB)

Note: The screenshot displays the second infobox table caption, "State symbols of California" on multiple lines. I assume the multiline format is for long captions so I left the caption title as-is. Also, Wikipedia Apps displays the same caption on multiple lines on a tablet device.

Change #1335809 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] Quick facts: support legacy parser

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

Change #1332498 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Quick facts: move lead infoboxes into a collapsible section

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

The legacy parser patch ((https://gerrit.wikimedia.org/r/1335809) is ready for code review.

Verified the following for the quick facts section heading:

  1. taps on the section heading toggles between expand/collapse via keyboard
  2. screen reader / VoiceOver on macbook seems fine. It announces button, label, and whether the section is expanded or collapsed.

Local setup instructions:

  • Enable quickfacts with $wgMFQuickFacts = [ 'base' => true ]; in LocalSettings.php
  • Install ParserMigration extension and then use URL query to switch between legacy parser (?useparsoid=0) and Parsoid (?useparsoid=1).
lwatson changed the point value for this task from 1 to 3.

Parser outputs

Parsoidlegacy parser
quickFacts_parsoid_output.png (1,528×1,234 px, 522 KB)
quickFacts_legacy_parser_output.png (1,538×1,242 px, 553 KB)

Two separate counts:

  • server-side counting: MakeSectionsTransform assigns a number to mf-section-N. The legacy section deliberately has no mf-section-N id so that existing section numbers and the edit links that point to them are unaffected. Tradeoff: we lose the interim pre-JavaScript onclick handler (mfTempOpenSection) that lets a tap open a section before the JavaScript loads.
  • client-side counting: Toggler.js assigns each section-heading an index number that is used for content-collapsible-block-{i} (the content div's id) and aria-controls pairing between a heading and its content. The section-heading is what makes the Toggler recognize and collapse it. Nothing outside of Toggler reads it so it appears harmless.

Change #1335809 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Quick facts: support legacy parser

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

Assigning Elena to QA on beta cluster. Example: https://en.wikipedia.beta.wmcloud.org/wiki/California?useformat=mobile&quickfacts=1 (noticing that the article's beta cluster version only has one infobox in the lead). Do you know of articles on beta clusters with multiple lead infoboxes?

Change #1336789 had a related patch set uploaded (by LWatson; author: LWatson):

[mediawiki/extensions/MobileFrontend@master] ExtMobileFrontend: restore IContextSource for domParseMobile

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

Change #1336789 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] ExtMobileFrontend: restore IContextSource for domParseMobile

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

Etonkovidova subscribed.

Checked on patchdemo https://ae223a3a21.catalyst.wmcloud.org/wiki/Hindustani_language?useformat=mobile&quickfacts=1
California article - two infoboxes - both infoboxes collapsed into Quick facts section.
click on an animated gif:

quick_facts truncation .gif (434×905 px, 1 MB)

To : the article https://en.wikipedia.org/wiki/Hindustani_language contains two infoboxes - Infobox language and Hindustani language. Another template - Contains special characters is placed between them. Collapsing Quick facts results in a successful collapse of thoe two infoboxes, but the Contains special characters template remains in its place - see the comparison below on how both infoboxes and the template are displayed in different environments:

enwiki productionAndroid Mobile apppatchdemo
Screenshot 2026-09-07 at 10.55.42 AM.png (726×767 px, 288 KB)
Screenshot 2026-09-07 at 10.48.58 AM.png (397×728 px, 116 KB)
Screenshot_20260907-072815_Wikipedia.jpg (1,080×2,220 px, 577 KB)
Collapsed Quick facts (with both infoboxes) pushed dowon to the end of the lead section
Screenshot 2026-09-07 at 11.10.37 AM.png (890×1,754 px, 423 KB)

To : the article https://en.wikipedia.org/wiki/Hindustani_language contains two infoboxes - Infobox language and Hindustani language. Another template - Contains special characters is placed between them. Collapsing Quick facts results in a successful collapse of thoe two infoboxes, but the Contains special characters template remains in its place - see the comparison below on how both infoboxes and the template are displayed in different environments:

enwiki productionAndroid Mobile apppatchdemo
Screenshot 2026-09-07 at 10.55.42 AM.png (726×767 px, 288 KB)
Screenshot 2026-09-07 at 10.48.58 AM.png (397×728 px, 116 KB)
Screenshot_20260907-072815_Wikipedia.jpg (1,080×2,220 px, 577 KB)
Collapsed Quick facts (with both infoboxes) pushed dowon to the end of the lead section
Screenshot 2026-09-07 at 11.10.37 AM.png (890×1,754 px, 423 KB)

Mmh. From my perspective, I think the behaviour is fine. The special chars notice is not an infobox, nor particularly infobox-related. I imagine it just happens to also be located in-between the infoboxes for similar reasons (important content, but not necessarily meant to intrude into the rest of the article content too much, so off to the side), and we do want it to stay in its original location rather than moving it away into the new infobox section.
@JScherer-WMF Can you confirm that above is indeed fine? If yes, we can resolve this ticket!

@JScherer-WMF Can you confirm that above is indeed fine? If yes, we can resolve this ticket!

Confirmed that this is fine. If this is coming up a lot, we can try and treat it with targeted bug fixes after the experiment.