Page MenuHomePhabricator

Allow editing the lead section of a page
Open, MediumPublicFeature

Description

Background goal

When an article consists of different sections and the first section does not contain a header (== header ==) it can not be edited seperately but you have to edit the complete article to change the section. This is especially bad if the page is very large where the complete page has to be loaded and saved back to the database.

Suggestion: let Mediawiki check if there are sections, if so and there is no heading in the first one craeate a link to edit this first section (if there is a header there is no problem).

For examples take a look at http://de.wikipedia.org/wiki/Wikipedia:Mailinglisten and you see what I mean.

This functionality is provided by a gadget on many wikis. It goes by various names, and there are minor differences in functionality. As of November 2025 the gadget counts are as follows:

Original bug author: tluft

Current behavior across skins and platforms
Desktop (Vector 22, Vector legacy, Timeless): uses a [edit] link to open the edit mode. The top tab "Edit" opens the full page editing while the [edit] on each section's title open that section to edit.
Captura de pantalla 2025-11-21 a las 13.06.25.png (2,226×1,530 px, 1 MB)
Minerva: uses an icon-only button to open the edit mode. The top edit button currently opens the 1st section (lead section) editing, while the pencil icon on each section's title open that section to edit.
Captura de pantalla 2025-11-21 a las 13.08.37.png (450×1,344 px, 382 KB)
App: uses an icon-only button to open the edit mode. There is an option to edit the lead section included within the first block of text. When clicking on it, it displays a menu with 2 options: Edit description of the article / Edit introduction
Captura de pantalla 2025-11-21 a las 13.12.05.png (1,222×1,200 px, 1 MB)

Proposed solution

desiger: @bmartinezcalvo

  • Include an option to edit the lead section within the first paragraph of the lead section (same as in App).
  • Use a Tooltip when hover over the different edit options, indicating which part of the article will be edited.
  • Depending on how much we want to unify the experience across skins and platforms — and how prominent we want the edit action to be — there are 2 possible solutions:
    1. Use the [edit] link on desktop and an icon-only button on mobile. This approach follows the current production pattern and maintains the traditional behavior.
    2. Use the pencil icon-only button across all skins. This option unifies the experience across platforms, making the edit action more prominent and visually inviting.
Captura de pantalla 2025-11-21 a las 13.19.57.png (2,358×1,096 px, 859 KB)
Captura de pantalla 2025-11-21 a las 13.19.04.png (2,228×1,064 px, 785 KB)
Using [edit] link on desktopUnifying to pencil icon-only button in all skins

WIP implementation

Engineer: @Samwilson

  • https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1207828
  • How to try out?: Vector-2022 & Vector
  • Status:
    • Experimenting with Vector (both) to put the edit link in the 1st paragraph of the intro.
    • Unclear if it should be a skin feature or in Core. Or the new WikimediaCustomizations extension.
  • Next steps:
    • Gate behind a feature flag, and add to the Experimentation Lab.
    • When VE isn’t installed, or in VE’s single-tab mode, use an icon instead of the word ‘edit’.
    • Regardless of the edit link, the prefilled edit summary could be added, e.g. /* top */

Open questions

  • Do we want to replace the [edit] link with an icon-only button to unify the experience across all skins?
  • Do we want this solution be just a skin feature or in core?

Acceptance criteria (or Done)

  •  Explore possible solutions
  • Decide on using [edit] link or icon-only button on the different skins

Details

Reference
bz156
Related Changes in Gerrit:

Revisions and Commits

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@matmarex that's good to know. whatever solution we come up with here has more shelf life. Thank you!

I will draw some stuff up and present here.

I've been looking at the way the mobile app is doing this in the latest iteration: https://www.mediawiki.org/wiki/Wikimedia_Apps/Short_descriptions

And that's actually pretty damn interesting. I'd be all for a 'progressive' enhanced edit link, that when hovered or selected allows you to pick from "Edit full article, Edit this section, Edit summary description (wikidata), Edit page title". Might be interesting to build a gadget to experiment with that. When you don't have JS enabled, it could be just a edit section 0 link.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:24 PM

To edit an introduction, we have to edit the whole article. The problem is that it isn't possible on a large page using the new VisualEditor. It requires just too much CPU or cache. The page freezes and then the browser (edge Windows 10) too. We need to kill and restart the browser.
The introduction of an article is a section by itself, it should thus be editable (without having to open the whole article in the editor)

EDIT:
the solution mentioned above is working: go in preference/gadget/ under "Appearance" check the box "Add an [edit] link for the lead section of a page"

Some skins have tasks already for adding or improving section-0 edit links:

It sounds like the simplest cross-skin approach might be to add it to the tools menu.

Change #1207828 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/skins/Vector@master] Add section-0 edit link to the first paragraph on a page

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

Is it necessary/good/bad/confusing/marvellous to add the /* top */ (English), /* ievads */ (Latvian), /* đầu */ (Vietnamese) etc. to the edit summary when editing section zero? Most of the gadgets and scripts do so (and none appear to localize it). But this means that it appears as a normal-looking section title in the history, diff, etc. even though the link that gets created for it doesn't actually link to anything.


The above patch for Vector is a bit of an exploration of what it'd be like if the edit link(s) were added at the top of the first paragraph on a page and then floated to the end of the line, e.g.:

image.png (985×659 px, 144 KB)

It's not yet ready for review, and perhaps doesn't even belong in Vector.

Good idea to add /* top */, bad idea to translate it. #top is part of the HTML specs so translating it would be confusing.

The above patch for Vector is a bit of an exploration of what it'd be like if the edit link(s) were added at the top of the first paragraph on a page and then floated to the end of the line, e.g.:

image.png (985×659 px, 144 KB)

It's not yet ready for review, and perhaps doesn't even belong in Vector.

I find it intrusive and ugly as sticks out in the reading part.

Good idea to add /* top */, bad idea to translate it. #top is part of the HTML specs so translating it would be confusing.

It's a string that's seen by users, and it'd be much better to translate it. They don't care that HTML has some internal feature for linking to #top, and would just see some randon word that sticks out from its surroundings:

image.png (472×201 px, 39 KB)
image.png (477×148 px, 17 KB)

I find it intrusive and ugly as sticks out in the reading part.

I think it's better than having the links far separated from the first section, as they are in Vector-2022:

image.png (644×129 px, 13 KB)

The screenshot I posted earlier also has the two edit links, and in many situations it'd just be one, which is a bit neater. There's also a possibility of, if it's a single link, showing it as a pencil icon. That looks pretty good:

image.png (977×665 px, 146 KB)

It's a string that's seen by users, and it'd be much better to translate it. They don't care that HTML has some internal feature for linking to #top, and would just see some randon word that sticks out from its surroundings:

image.png (472×201 px, 39 KB)
image.png (477×148 px, 17 KB)

There isn't even an equivalent that conveys the same thing as #top, because the web is already Latin/English-based. How is one supposed to tell the difference between a translation of top and a section named that? Note many languages don't have the notion of casing. The fact there's suddenly an English word efficiently conveys it's about something technical.

You seem to be coming from the perspective of an English speaker who's used to seeing everything in the same language. That is simply not the experience of the web for most people around the world. Never impose it on others without consulting them first.

/* top */ must be translated of course. There shouldn't be any non-localized strings in the interface :)

https://ru.wikipedia.org/wiki/MediaWiki:Gadget-edittop.js

bmartinezcalvo renamed this task from Add section edit link for 0th section of a page/article to Allow to edit the lead section of an article.Nov 21 2025, 12:36 PM
bmartinezcalvo updated the task description. (Show Details)
bmartinezcalvo updated the task description. (Show Details)
bmartinezcalvo updated the task description. (Show Details)
bmartinezcalvo edited subscribers, added: bmartinezcalvo; removed: • MZMcBride.

Following the work @Samwilson and I have been doing during the Wishathon 2025, I’m sharing the explorations and WIP implementation so we can keep iterating (also shared in the task's description):

Design proposal:
  • Include an option to edit the lead section within the first paragraph of the lead section (same as in App).
  • Use a Tooltip when hover over the different edit options, indicating which part of the article will be edited.
  • Depending on how much we want to unify the experience across skins and platforms — and how prominent we want the edit action to be — there are 2 possible solutions:
    1. Use the [edit] link on desktop and an icon-only button on mobile. This approach follows the current production pattern and maintains the traditional behavior.
    2. Use the pencil icon-only button across all skins. This option unifies the experience across platforms, making the edit action more prominent and visually inviting.
Captura de pantalla 2025-11-21 a las 13.19.57.png (2,358×1,096 px, 859 KB)
Captura de pantalla 2025-11-21 a las 13.19.04.png (2,228×1,064 px, 785 KB)
Using [edit] link on desktopUnifying to pencil icon-only button in all skins
WIP implementation:

Engineer: @Samwilson

  • https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1207828
  • How to try out?: Vector-2022 & Vector
  • Status:
    • Experimenting with Vector (both) to put the edit link in the 1st paragraph of the intro.
    • Unclear if it should be a skin feature or in Core. Or the new WikimediaCustomizations extension.
  • Next steps:
    • Gate behind a feature flag, and add to the Experimentation Lab.
    • When VE isn’t installed, or in VE’s single-tab mode, use an icon instead of the word ‘edit’.
    • Regardless of the edit link, the prefilled edit summary could be added, e.g. /* top */
Open question to resolve before moving forward
  • Do we want to replace the desktop [edit] link with an icon-only button to unify the experience across skins?
NOTE: this is WIP; feedback on the open question will help us finalize and ship.

There shouldn't be any non-localized strings in the interface :)

top is not part of the interface. It's code. It's in the HTML specs. Translating it would mean adding an ID that varies by site language to every single wiki page, elements on which would need to avoid duplicating. That's a disruptive change nowhere near the scope of this task.

If you're proposing /* top */ appear translated rather than "→top" only in the parsed result (and still linking to #top), I can see some reason for it. But if you mean changing /* top */ and adding an ID to the top of every page, that's not something you should entertain so willy-nilly.

If you're proposing /* top */ appear translated rather than "→top" only in the parsed result (and still linking to #top), I can see some reason for it. But if you mean changing /* top */ and adding an ID to the top of every page, that's not something you should entertain so willy-nilly.

What I'm saying is that the edit summary shouldn't contain English words that part of the user don't understand.

+1 Iniquity. The string in the edit summary should be localizable. Or...
Or, perhaps it should be left out entirely, if localizing it is much harder?
Or if there are concerns about the UX being confusing? (I.e. When *normally* the /* string */ results in a link to a relevant section (from History/Diff/Feed pages) but in these cases it won't.)
Personal context: I usually just delete that "/* top */" placeholder, when I'm editing with the gadget on Enwiki, as the "top" doesn't really provide any useful context beyond the edit summary I manually write; it's just clutter in my opinion/experience.

For reference, from a quick skim check of a few gadget examples:
The Viwikibooks gadget uses /* đầu */
The Srwiki gadget uses /* увод */ or /* topувод */ (I'm not certain what the distinction is, code-wise or linguistically)
The Frwiki gadget uses /* Introduction */ for French language users (and, perhaps confusingly(!?), uses /* Lead section */ for English language users. I imagine it ought to be consistent for everyone on a monolingual wiki-project?).

What I'm saying is that the edit summary shouldn't contain English words that part of the user don't understand.

I have news for you: The source of virtually any wikipage that's not in English contains—if not is littered with—English words. Sure, magic words and template names and parameters can be translated, but they frequently are not, and HTML(-like) tags can't be translated at all. Not to mention many punctuation characters in the ASCII set are culturally specific to Europe/anglosphere (less tech-savvy East Asian users are frequently confused when full-width characters don't generate code). /* top */ is code that generates a link to #top, which is in the HTML specs. That's no different from <b> or <span> or class=. If you think top should be translated then you should think those should be translated too (which I don't). If you think you're doing non-English speakers a service by translating it, I find that naive and short-sighted.

For reference, from a quick skim check of a few gadget examples:
The Viwikibooks gadget uses /* đầu */
The Srwiki gadget uses /* увод */ or /* topувод */ (I'm not certain what the distinction is, code-wise or linguistically)
The Frwiki gadget uses /* Introduction */ for French language users (and, perhaps confusingly(!?), uses /* Lead section */ for English language users. I imagine it ought to be consistent for everyone on a monolingual wiki-project?).

And those links lead nowhere! (Or worse, to the wrong sections.) I don't see any element with id="đầu" etc. on those wikis. It's clear they didn't understand top was code that means something in HTML, as these links show: #top / #đầu. One navigates you to the top of the page, the other does nothing. Porters on the other 100+ wikis seemingly understood that.

Vector

I find this intrusive and ugly, inhibiting the reading experience. If it's how it's going to be implemented, I'll keep using the edittop gadget, which defeats the whole point of this task viz. to make the gadget redundant.

The current position the gadget puts the link in is obvious and intuitive in Vector legacy and Timeless, as it's under the full page edit link. For Vector 2022 you might as well put it in p-cactions just like Minerva (but section and full page reversed).

Nardog renamed this task from Allow to edit the lead section of an article to Allow editing the lead section of a page.Nov 24 2025, 7:31 AM

Placing the [edit] link to the left of the infobox is actually technically quite complex and the WIP patch already shows some of this https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1207828. Aside from the fact that we are placing more UI within the content area, which will require some review by the Content Transform Team, it is essentially the same problem as lede-paragraph hoisting that is done on Mobile Web and Mobile Apps. Web and apps have slightly different implementations and neither are perfect. There is also some tech debt around those as well as outstanding tasks to unify the logic (T277367, T359002).

@Samwilson @Nardog @Iniquity @Quiddity Regarding /* top */ and #top, I think the ideal option would be to use /* */ when editing the lead section and make it link to # (currently it does not produce a working link), and display a special localisable message for that case in the edit summary renderer. That would keep the functionality, and wouldn't cause any localisation problems, as far as I can tell. It could be done here in the code.

Note that both #top and # are special cases in the HTML spec that link to the top of the document, although #top will instead link to an element with that ID if one is present, while # always goes to the top:

  1. If fragment is the empty string, then return the special value top of the document.

(...)

  1. If decodedFragment is an ASCII case-insensitive match for the string top, then return the top of the document.

I think we could split out the edit comment changes from this and into a new task, as we can implement that separately (after all, it's already possible to edit section 0; this task is about how to link to doing so — perhaps 21 years ago when the task was opened, it was about the whole lot). Those are good ideas @matmarex about how to link and localize it. I agree that we shouldn't implement anything that's not translatable.

Strong agree @Esanders on the above approach to adding in the edit link being not a very good way to do it! :-) I just wanted to get something working during the wishathon last week. It's how MobileFrontend is doing it, but surely we shouldn't need to be re-parsing the HTML to do this. If we agree on where the link should go, we can figure out how to implement it properly.

Adding a 'edit lead section' link to the tools menu is much simpler, and might be the easier thing to do here. That wouldn't get in the way of anyone, and it'd echo the 'edit full page' menu item that's on mobile.

Adding a 'edit lead section' link to the tools menu is much simpler, and might be the easier thing to do here. That wouldn't get in the way of anyone, and it'd echo the 'edit full page' menu item that's on mobile.

+1.

How should this be worded for Tech News?

There's nothing to announce on Tech News yet.

Change #1207828 abandoned by Samwilson:

[mediawiki/skins/Vector@master] Add section-0 edit link to the first paragraph on a page

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

I think these subtasks resolve the internationalization issues with the hard-coded English word "top". Instead of /* top */, an empty autocomment like /* */ can be used now, and it displays a localized label when saved. It is prefilled in the edit summary when following a link such as https://test.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&section=0.

May I ask you all to update (or request updates to) your local gadgets to remove the &summary=/* top */ (or localised versions) from the action=edit&section=0 links they add, which will cause /* */ to be used instead, and see if people agree that it's a good change?

There's nothing to announce on Tech News yet.

I think

May I ask you all to update (or request updates to) your local gadgets to remove the &summary=/* top */ (or localised versions) from the action=edit&section=0 links they add, which will cause /* */ to be used instead, and see if people agree that it's a good change?

^ this is worth announcing now.

May I ask you all to update (or request updates to) your local gadgets…

Alright, I requested one myself: https://en.wikipedia.org/wiki/MediaWiki_talk:Gadget-edittop.js#Edit_request:_Use_new_default_autocomment

Yes, but (as a global interface editor myself) I am not sure that this would be appreciated, and we must not make "any controversial edits". I am hoping that a few projects will adopt this, receive positive comments about the change (or at least no negative ones), and at that point it will be uncontroversial to apply on projects that don't have very active gadget maintainers.

FWIW it didn’t get a lot of questions in Russian Wikipedia, just this one (with some suggestions that it should link to the actual start of the article instead):
https://ru.wikipedia.org/wiki/Википедия:Форум/Технический#c-Jet_Jerry-20260503213500-Редактирование_первого_раздела_статьи

Personally I worry that this new syntax might be misinterpreted by some people to mean that they should put their edit summary inside /* */, which was already a bit of a problem with newer editors before the change. It’s not a huge problem but it is a potential one for this particular syntax. That could be solved hopefully for good by implementing some sort of autopreview for edit summaries, though (but of course someone would have to write that).

The edit notification e-mails include the un-adjusted edit summary "/* */"

Do we or can we get some statistics on how many total edits have happened only on the lead section of an article within a given amount of time? Say last 6 months. The tools menu already has a lot of links depending on the wiki so adding more actions will only crowd it further.

You can check for edits with specific summaries in wikis where this is already default for a long time, like Russian Wikipedia (/* Преамбула*/ was added by the gadget, now it is /* */). That should probably lend the appropriate statistics.