Page MenuHomePhabricator

Editing a section not followed by a blank line before the next section adds a new blank line without editor intervention
Open, Needs TriagePublicBUG REPORT

Description

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

  • Go to https://en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_Catalan-speaking_countries
  • Be in Vector 2022.
  • [edited to add:] Enable the gadget called "Add an [edit] link for the lead section of a page" in your Preferences.
  • Use the default MediaWiki editor from 2003
  • Disable Visual Editor
  • Click the [edit] link at the top right of the page, to the right of the page title and just to the left of "Add topic", to edit the lead section only
  • Do not make any changes in the edit window
  • Click "Show changes"

What happens?:

  • You will see a diff showing that a blank line has been inserted after the contents of the lead section and the first second-level header, even though you have not added that line in editing

What should have happened instead?:

  • No blank line should be inserted, since the editor has not added a blank line. The MediaWiki editing software should not insert characters that the editor does not insert themselves.

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

Other information (browser name/version, screenshots, etc.):
I have been clicking [edit] and then Publish on the lead section for over ten years in order to do a quick null edit on pages. Just in the last week, I have occasionally been prompted for an edit summary (by the "Prompt me when entering a blank edit summary" preference), because the software thinks that I have added a new line. The new line appears to be added by the MediaWiki software (or a gadget, maybe). I have not changed any preferences or relevant .js, to my knowledge.

This issue does not always happen. I believe that this issue happens only when there is no blank line between the lead section content and the first level-two header. For example, this issue does not happen at https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Catalan-speaking_countries/Style_advice where I can click [edit] and Publish without triggering the addition of a new line.

Possibly related: T2156

Event Timeline

I cannot reproduce the problem. For clarity: Do you mean the "edit" tab between "Read" and "View history" (an image would help)? I ask because I see the language symbol and the "Add topic" button to the right of the page title.

@Jonesey95: Can you reproduce the problem in a "private browser window" or with "Always enable safe mode" (Preferences/Appearance/Advanced options)? This would clarify the role of personal scripts.

You probably have to turn on the gadget called "Add an [edit] link for the lead section of a page".

This [edit] link, which is for editing the lead section of the page (hence "to edit the lead section" in the bug description), is directly to the right of the page title, and just to the left of the new, bold "Add topic" link. For me, it renders just above "View history".

An aside: This "edit the lead section" [edit] link was moved to this less-logical location when Vector 2022 was deployed; in Vector legacy, the title and this [edit] (edit the lead section) link are below the Read/Edit whole-page links, which made more sense.

I can reproduce the problem by copying https://en.wikipedia.org/wiki/MediaWiki:Gadget-edittop.js to my common.js in de.Wikipedia. The minimal page

A
== B ==

shows the problem. The change to the gadget from 13 May 2026 (previous version was from 5 September 2023, history under https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-edittop.js&action=history ) makes no difference for me regarding the problem.

So all in all: the behavior of Gadget-edittop.js changed last week without changes to the gadget itself.

This is not an issue in the gadget nor related to lead section editing, this is how section editing in general behaves (try it).

This is not an issue in the gadget nor related to lead section editing, this is how section editing in general behaves (try it).

Thanks for that. I can confirm that this bug affects any section, not just the lead. Try editing section 2 at https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=1364782805 and clicking Show changes without changing anything (Vector 2022, default MediaWiki editor from 2003). An extra line is added without the editor's action or consent.

Please roll back this change.

Jonesey95 renamed this task from Editing top section adds a new blank line without editor intervention to Editing a section not followed by a blank line before the next section adds a new blank line without editor intervention.Sat, Jul 18, 2:24 PM

Right now, with 1.47/wmf.11 in group 2 wikis, the effect is there even in a private window for

A
== B ==
== C ==

But I want to point out that wmf.11 went to production in group 2 wikis 2026-07-16
18:18 , after my answer from Thu, Jul 16, 5:31 AM, where I had to modify my common.js to see the "new blank line problem".