Page MenuHomePhabricator

Bug: MobileFrontend wraps entire article with semantically incorrect mf-section-0 element.
Closed, ResolvedPublic3 Estimated Story Points

Description

Steps to replicate the issue (include links if applicable):

What happens?:

The entire article is wrapped in a section element with class="mf-section-0" and class="mf-section-1"

Screenshot 2024-09-11 at 2.19.43 PM.png (75×398 px, 14 KB)

This impacts editors who have added site specific rules to target the lead paragraph.

What should have happened instead?:

This wrapping section is not needed and shouldn't be there. The HTML hierarchy should be identical to the desktop site.

To fix this we should update MakeSectionsTransform so that it doesn't apply to Parsoid content. It can do this by checking for the presence of the data-mw-parsoid-version attribute. We already do this in includes/Transforms/LazyImageTransform.php

Please add a test!

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

QA steps

  • Confirm that there is no wrapping section
  • Confirm that the lazy image transform has not been impacted and that first section images are never lazy loaded.

Derived Requirement

Ensure that Parsoid content on the mobile version of Wikivoyage articles does not contain unnecessary wrapping section elements (mf-section-0 and mf-section-1), and verify that the lazy image transform remains unaffected.

BDD

Feature: Correct HTML hierarchy for Parsoid content on mobile Wikivoyage

Scenario: Ensure Parsoid content is not wrapped in unnecessary section elements

Given the user is viewing a Wikivoyage article using Parsoid content on the mobile site
When the article is rendered
Then no unnecessary wrapping section elements (class="mf-section-0" and class="mf-section-1") should be present
And the lazy image transform should remain unaffected
Test Steps

Test Case 1: Ensure no unnecessary section wrapping in Parsoid content on the mobile Wikivoyage article

Open the Wikivoyage article for Costa Maya here.
View the source of the page.
✅❓❌⬜ AC1: Confirm that there are no section elements with class="mf-section-0" and class="mf-section-1" wrapping the article's content.

Test Case 2: Ensure lazy image transform is not impacted for first section images

Verify that images in the first section of the article are not lazy-loaded.
✅❓❌⬜ AC2: Confirm that the lazy image transform is functioning correctly, and images in the first section are not lazy-loaded.

QA Results - Wikivoyage PROD

ACStatusDetails
1T374578#10173451
2T374578#10173451

Event Timeline

Jdlrobson set the point value for this task to 3.

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

[mediawiki/extensions/MobileFrontend@master] Avoid wrapping sections on parsoid

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

bwang removed bwang as the assignee of this task.Sep 17 2024, 7:13 PM
bwang subscribed.

Change #1073516 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Avoid wrapping sections on parsoid

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

GMikesell-WMF updated Other Assignee, added: Edtadros.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF added a subscriber: Edtadros.

Test Result - Wikivoyage PROD

Status: ✅ PASS
Environment: Wikivoyage PROD
OS: macOS Sonoma 14.6.1
Browser: Chrome 128
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://en.m.wikivoyage.org/wiki/Pisa?useparsoid=1&debug=1

Test Steps

Test Case 1: Ensure no unnecessary section wrapping in Parsoid content on the mobile Wikivoyage article

Open the Wikivoyage article for Costa Maya here.
View the source of the page.
✅ AC1: Confirm that there are no section elements with class="mf-section-0" and class="mf-section-1" wrapping the article's content.

No section element but with a presence of the data-mw-parsoid-version attribute
2024-09-24_15-06-59.png (1×1 px, 621 KB)

Test Case 2: Ensure lazy image transform is not impacted for first section images

Verify that images in the first section of the article are not lazy-loaded.
✅ AC2: Confirm that the lazy image transform is functioning correctly, and images in the first section are not lazy-loaded.

2024-09-24_15-05-00.mp4.gif (1×1 px, 2 MB)

GMikesell-WMF assigned this task to ovasileva.
GMikesell-WMF updated Other Assignee, removed: Edtadros.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF subscribed.

Change #1134107 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[operations/mediawiki-config@master] Where Parsoid Read Views are the default, use it for MFE as well

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

Change #1134107 merged by jenkins-bot:

[operations/mediawiki-config@master] Where Parsoid Read Views are the default, use it for MFE as well

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

Mentioned in SAL (#wikimedia-operations) [2025-04-07T13:05:15Z] <jforrester@deploy1003> Started scap sync-world: Backport for [[gerrit:1134106|Shift to Parsoid Fragment support v3 (T390420)]], [[gerrit:1134107|Where Parsoid Read Views are the default, use it for MFE as well (T376048 T374578)]]

Mentioned in SAL (#wikimedia-operations) [2025-04-07T13:10:35Z] <jforrester@deploy1003> jforrester, cscott: Backport for [[gerrit:1134106|Shift to Parsoid Fragment support v3 (T390420)]], [[gerrit:1134107|Where Parsoid Read Views are the default, use it for MFE as well (T376048 T374578)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-04-07T13:26:10Z] <jforrester@deploy1003> Finished scap sync-world: Backport for [[gerrit:1134106|Shift to Parsoid Fragment support v3 (T390420)]], [[gerrit:1134107|Where Parsoid Read Views are the default, use it for MFE as well (T376048 T374578)]] (duration: 20m 54s)