Page MenuHomePhabricator

Anchors for original heading titles shouldn't be distributed by MassMessage
Open, MediumPublicBUG REPORT

Description

Recently, a new feature was introduced: T62544: Automatically add anchor for original (English on Wikimedia) version of heading title. However, this feature adds anchors to texts distributed using MassMessage:

Here is an example of an anchored section title that was distributed:

<div class="plainlinks mw-content-rtl" lang="ar" dir="rtl">
[[File:Growth_team_logo_-_Icon_only.svg|right|frameless]]

مرحبا بكم في النشرة الإخبارية الثانية والعشرين من [[mw:Special:MyLanguage/Growth|فريق النمو]]!

<span id="Newcomers_tasks_reach_the_500,000_edits_milestone_—_more_data_publicly_available"></span>
===فاقت تعديلات الوافدين الجدد حاجز الـ 500000 تعديل — المزيد من البيانات متاحة للعموم===

Ideally, MassMessage should strip off these anchors, as the targeted page is in one language, with no need to refer to an original anchoring.

Event Timeline

Does the anchor cause issues or is this just a suggestion for improvement?

In some (rare) cases, this may be useful to keep them: if the message contains links to some sections of it, e.g. if it contains some kind of ToC.

Does this empty span produce some issues on targeted wikis?

I’d avoid links to sections within the message: you cannot make sure that none of the anchors already exist on any of the talk pages the message will be distributed to. If an anchor already exists on a talk page, the link will point there instead of the one within the just-distributed message, since the existing one will be higher up on the page.

Does the anchor cause issues or is this just a suggestion for improvement?

It is a suggestion for improvement. Anchors are only visible if you edit wikitext, and some users like to have clean wikitext, with no extras.

In some (rare) cases, this may be useful to keep them: if the message contains links to some sections of it, e.g. if it contains some kind of ToC.

As the message can have two aspects (translated or untranslated) and is distributed "as is", I'm not sure of this use case.

Does this empty span produce some issues on targeted wikis?

I'm not aware of an issue, as I just discovered this today, and manually removed the anchors before sending my message.

I’d avoid links to sections within the message: you cannot make sure that none of the anchors already exist on any of the talk pages the message will be distributed to. If an anchor already exists on a talk page, the link will point there instead of the one within the just-distributed message, since the existing one will be higher up on the page.

Good point: if one arrives on the wrong section just because of the anchors, it could be confusing.

Nikerabbit changed the subtype of this task from "Task" to "Feature Request".
siebrand changed the subtype of this task from "Feature Request" to "Bug Report".Aug 31 2026, 2:04 PM
Anushka10patel subscribed.

Hi! I’d like to work on this task. I plan to investigate how MassMessage processes message content, identify where the Translate-generated heading anchors can be removed, and add appropriate test coverage for the fix. I’m new to contributing to MassMessage and would appreciate any guidance or feedback.

Change #1343216 had a related patch set uploaded (by Anushka10patel; author: Anushka10patel):

[mediawiki/extensions/MassMessage@master] MassMessage: Remove Translate heading anchors

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

Editors may add such an empty tag for other purpose (custom anchor, script…). In order to avoid this change to wrongly remove them, I see 3 possibilities:

  1. We recommend editors to add any other attribute to the tag (e.g. class="keepInMassMessage").
  2. We make Translate add a specific attribute (e.g. data-Translate="original-anchor"), so this MassMessage change can target it instead of any empty span tag.
  3. This MassMessage change gets the original anchor first, and look for it in translation pages instead of any empty span tag.

Editors may add such an empty tag for other purpose (custom anchor […]).

They shouldn’t. Such anchors would suffer from the same problem as Translate-generated ones: when delivered on a talk page with many other topics, there’s no guarantee they’re going to be unique. Content to be recognized by scripts can use class names instead of IDs, custom anchors shouldn’t be present.

Editors may add such an empty tag for other purpose (custom anchor […]).

They shouldn’t. Such anchors would suffer from the same problem as Translate-generated ones: when delivered on a talk page with many other topics, there’s no guarantee they’re going to be unique. Content to be recognized by scripts can use class names instead of IDs, custom anchors shouldn’t be present.

A well-chosen namespace should be sufficient to make the anchor unique. Anchors are a basic and useful HTML feature which is supported; in my opinion, we shouldn’t discourage them.