Page MenuHomePhabricator

Section selector shows html markup in section title and such sections fails to load
Closed, ResolvedPublic8 Estimated Story PointsBUG REPORT

Assigned To
Authored By
santhosh
Feb 27 2025, 3:34 AM
Referenced Files
F66484999: image.png
Sep 24 2025, 2:53 PM
F65922338: 2025-08-27_13-04-16.png
Aug 27 2025, 10:24 PM
F65922331: 2025-08-27_13-01-35.png
Aug 27 2025, 10:24 PM
F65922295: 2025-08-27_12-51-52.mp4
Aug 27 2025, 10:24 PM
F65922301: 2025-08-27_12-54-04.mp4
Aug 27 2025, 10:24 PM
F58929992: Screenshot 2025-03-27 at 16.38.31.png
Mar 27 2025, 1:42 PM
F58508877: image.png
Feb 27 2025, 3:34 AM
F58508875: image.png
Feb 27 2025, 3:34 AM

Description

Section selector shows html markup in section title and such sections fails to load. See the screenshot below.

image.png (828×907 px, 73 KB)
image.png (831×953 px, 57 KB)

Derived Requirements

  1. Ensure that section titles in the section selector are displayed as plain text, without rendering raw HTML markup.
  2. Sections containing HTML markup in their titles must load correctly in the Content Translation workflow.
  3. The section selector must remain fully functional and not break when encountering special characters, HTML tags, or formatting within section titles.
  4. The solution should work consistently across different languages and wikis.
Test Steps

Test Case 1: Verify section selector handles HTML markup in titles

  1. Open Content Translation on Wikipedia.
  2. Select a source article that has section titles containing HTML markup (e.g., <i>, <b>, <span>).
  3. Open the section selector.
  4. ✅❓❌⬜ AC1: Confirm that section titles are displayed as plain text without showing raw HTML tags.
  5. ✅❓❌⬜ AC2: Confirm that selecting such a section loads the section content correctly without errors.

QA Results - TestWiki

ACStatusDetails
1T387427#11126740
2T387427#11126740

Details

Other Assignee
GMikesell-WMF
Related Changes in Gerrit:
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Nikerabbit moved this task from Backlog to Core workflow on the SectionTranslation board.
Nikerabbit added a project: LPL Hypothesis.
SBisson moved this task from In-progress to Prioritized on the LPL Hypothesis board.
SBisson subscribed.

Change #1175200 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX: Add utility to sanitize HTML with escaped brackets using mw.message

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

Change #1175880 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Confirm translation: Use sanitized HTML for prefilled section title

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

Change #1175892 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Pick a section: Use v-html to display section titles

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

ngkountas changed the task status from Open to In Progress.Aug 5 2025, 12:50 PM
ngkountas moved this task from Prioritized to In-progress on the LPL Hypothesis board.

Change #1175892 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Pick a section: Use v-html to display section titles

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

Change #1176321 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Compare contents: Use sanitized HTML for section titles

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

Change #1176730 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Fetch section titles from API instead of extracting from content

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

Change #1176732 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX dashboard published translation: Use v-html for first missing section

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

Change #1176733 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX dashboard draft translation: Use v-html for the section title

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

Change #1175200 abandoned by Nik Gkountas:

[mediawiki/extensions/ContentTranslation@master] CX: Add utility to sanitize HTML with escaped brackets using mw.message

Reason:

In favor of a different approach, implemented here: If5000bacf78e5831d26df953d0108b9a1e428be4

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

Change #1175880 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Confirm translation: Validate section title and display it as HTML

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

Change #1176321 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Compare contents: Use valid section titles from cxserver with v-html

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

Change #1176730 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Fetch section titles from API instead of extracting from content

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

Change #1176732 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX dashboard published translation: Use v-html for first missing section

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

Change #1176733 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX dashboard draft translation: Use v-html for the section title

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

Change #1179651 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250818

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

Change #1179651 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250818

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

Change #1180127 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Filter non-top-level sections during section title assignment

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

Change #1180127 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Filter non-top-level sections during section title assignment

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

Change #1180824 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.15] Filter non-top-level sections during section title assignment

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

Change #1180836 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250821

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

Change #1180838 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.15] CX3 Build 1.0.0+20250821

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

Change #1180836 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250821

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

Change #1180838 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.15] CX3 Build 1.0.0+20250821

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

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:32:39Z] <kartik@deploy1003> Started scap sync-world: Backport for [[gerrit:1180838|CX3 Build 1.0.0+20250821 (T387427)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:36:42Z] <kartik@deploy1003> kartik: Backport for [[gerrit:1180838|CX3 Build 1.0.0+20250821 (T387427)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Change #1180824 abandoned by KartikMistry:

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.15] Filter non-top-level sections during section title assignment

Reason:

Use CX build backport instead.

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

Mentioned in SAL (#wikimedia-operations) [2025-08-21T13:52:17Z] <kartik@deploy1003> Finished scap sync-world: Backport for [[gerrit:1180838|CX3 Build 1.0.0+20250821 (T387427)]] (duration: 19m 38s)

@ngkountas It no longer appears on the section screen, but when you go to editing, the HTML markup shows up in the title, as seen in the videos below.

Test Result - TestWiki

Status: ❌ FAIL
Environment: TestWiki
OS: macOS Sequoia 15.6.1
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&active-list=suggestions&filter-id=previous-edits&filter-type=automatic&from=en&to=ml&page=Humayun%27s%20Tomb&section=%3Ci%3EChar%20Bagh%3C%2Fi%3E#/sx/section-selector
https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&filter-type=automatic&filter-id=previous-edits&active-list=suggestions&from=es&to=fr&page=Viviane%20Senna#/sx

Test Steps

Test Case 1: Verify section selector handles HTML markup in titles

  1. Open Content Translation on Wikipedia.
  2. Select a source article that has section titles containing HTML markup (e.g., <i>, <b>, <span>).
  3. Open the section selector.
  4. AC1: Confirm that section titles are displayed as plain text without showing raw HTML tags.
DesktopMobile

❌ Update from T387427#10683088
Is it supposed to have that reference number?

DesktopMobile
2025-08-27_13-01-35.png (1,719×971 px, 446 KB)
2025-08-27_13-04-16.png (797×1,077 px, 191 KB)
  1. AC2: Confirm that selecting such a section loads the section content correctly without errors.

See AC1

GMikesell-WMF updated Other Assignee, added: GMikesell-WMF.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from Needs QA to In-progress on the LPL Hypothesis board.
ngkountas changed the point value for this task from 4 to 8.Sep 4 2025, 12:19 PM

It no longer appears on the section screen, but when you go to editing, the HTML markup shows up in the title

Up until actually entering the editor, all text/labels are for display only. But then once inside the editor the expected behavior is: left column is read-only and right column is editable (desktop version). This introduces a new question then, how should we treat titles (with HTML) for the editable part? From my investigation:

  • The patch below [1] demonstrates how we could use OO.ui.HtmlSnippet for the read-only part inside the editor, but my understanding is that for editable fields, OOUI will always escape HTML for safety.
  • In production, section titles displayed with italics use wikitext for that (==''Char Bagh''==), for example, how does that play in as well?
  • Behavior that I'm seeing in the editor is that text formatting controls (italics, bold, etc) are disabled for titles [2].

We should talk about the expected/desired behavior inside the editor


[1] 1191070: Treat section titles with HTML in the editor | https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ContentTranslation/+/1191070

[2]

image.png (1,518×404 px, 68 KB)

ngkountas subscribed.

As discussed with the team, I have created a follow up ticket to treat the editor part (T410761) and will move this to Design Signoff