Page MenuHomePhabricator

Transcluded template-generated sections in parsoid read views are ignored by parser transformer leading to FOUC
Open, MediumPublic

Description

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

Note: This can be simulated by the following steps

  • Disable JavaScript
  • Update the HTML tag replacing client-nojs with client-js

What happens?:

Before JSAfter JS
image.png (468×449 px, 31 KB)
image.png (468×449 px, 31 KB)

The content of the section "Template generated section" is visible (briefly)

What should have happened instead?:

The section text after "Template generated section" should be hidden on initial page load.
Inspecting the HTML Parsoid has failed to wrap the content of the section with the appropriate DIV tag.
This looks like an issue in the logic
in the parser https://gerrit.wikimedia.org/g/mediawiki/core/+/c2c0388c0683b9b237bf7bb5fdb6acf0c2ab0233/includes/OutputTransform/Stages/HandleParsoidSectionLinks.php#42

Screenshot 2025-01-21 at 3.31.31 PM.png (726×756 px, 148 KB)

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

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

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Esanders renamed this task from Section collapsing doesn't work on template-generated sections in parsoid read views to Section content is briefly visible (FOUC) in template-generated sections in parsoid read views.Dec 6 2024, 1:06 PM
Esanders updated the task description. (Show Details)
Jdlrobson added subscribers: LMora-WMF, SToyofuku-WMF.

Seems like the section has an ID -1 which breaks assumptions made in the PHP transforms cc @SToyofuku-WMF and @LMora-WMF as this might be relevant to patches you are currently working on?

Interesting - do we know whether the ID of -1 is coming from the template or from the make sections transform hitting an error?

The data-mw-section-id attribute will either be "0" or greater and correspond exactly to a PHP section ID (as used for action=edit for example), or will be "-1" (indicating an uneditable non-pseudo section) or "-2" (indicating a pseudo-section, which is also uneditable).

https://www.mediawiki.org/wiki/Specs/HTML/2.8.0#Headings_and_Sections

Gotcha, thank you! Since it's parsoid specific we should definitely prioritize getting this fixed, but I don't believe it's related to the work we're doing right now in T374883

Jdlrobson triaged this task as Medium priority.Jan 6 2025, 6:42 PM
SToyofuku-WMF changed the task status from Open to In Progress.Jan 17 2025, 5:26 PM
Jdlrobson-WMF renamed this task from Section content is briefly visible (FOUC) in template-generated sections in parsoid read views to Section content is briefly visible (FOUC) in transcluded template-generated sections in parsoid read views.Jan 21 2025, 11:28 PM
Jdlrobson-WMF updated the task description. (Show Details)
Jdlrobson-WMF subscribed.

@SToyofuku-WMF this looks like an issue in the parser, not MobileFrontend.
I've started a Slack thread with Content transform team.

Jdlrobson-WMF renamed this task from Section content is briefly visible (FOUC) in transcluded template-generated sections in parsoid read views to Transcluded template-generated sections in parsoid read views are ignored by parser transformer leading to FOUC.Jan 21 2025, 11:37 PM

We are wrapping "well formed" sections, which are those we can support section editing on. I suppose we could also wrap malformed sections as well, but we'd probably skip adding section edit links to those sections. That might cause other issues.

I think we can arrange to wrap data-mw-section-id=-1 sections. But how do you expect data-mw-section-id=-2 sections to work? (See https://www.mediawiki.org/wiki/Parsing/Notes/Section_Wrapping#Pseudo-sections ).

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

[mediawiki/core@master] WIP: HandleParsoidSectionLinks: add collapsible wrappers around uneditable sections

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

Jdrewniak changed the task status from In Progress to Open.Feb 10 2025, 6:34 PM

Untagging myself from this as it's not actively being worked on rn

Note, we do plan to work on the logic in T374883: Section collapsing should not apply to certain pages - if a section is wrapped in a DIV it shouldn't be collapsed. In this situation, I honestly wouldn't even create a section element to be consistent with how the legacy parser in MobileFrontend works.