Page MenuHomePhabricator

Visual editor inserts extraneous blank lines (due to <nowiki/> pulled out of paragraph and then disappearing)
Closed, ResolvedPublic

Event Timeline

Any change to the first paragraph of the page seems to cause this.

There is a <nowiki/> tag in it, which becomes an alienMeta in our model and is pulled out of the paragraph (after it). But when we serialize to HTML, it seems that it is not put back in the expected place, resulting in HTML like this that we send to Parsoid:

<p id="mwAg">On June 12, 2018, …</p><span typeof="mw:Nowiki" id="mwBQ"></span><p id="mwCQ">Describing the image…</p>

The Parsoid presumably wraps the <span> in a paragraph, then removes the now-useless empty <nowiki/>, and that leaves it with an empty paragraph, which becomes two newlines in wikitext?

The Parsoid presumably wraps the <span> in a paragraph, then removes the now-useless empty <nowiki/>, and that leaves it with an empty paragraph, which becomes two newlines in wikitext?

More or less. It serializes as,

On June 12, 2018, …

<nowiki/>

Describing the image …

and then nowiki stripped in https://github.com/wikimedia/parsoid/blob/master/lib/html2wt/WikitextSerializer.js#L1457 leaving the three blank lines.

VE should be dropping nowikis in edited context and letting Parsoid reconstitute them where necessary.

From VE's perspective, this is basically the same issue as T96528: Empty annotations cannot be deleted. <nowiki/> (or <span typeof="mw:Nowiki"></span>) is treated the same as e.g. <small></small> by us, they only differ in Parsoid's handling.

matmarex renamed this task from Visual editor inserts extraneous blank lines. to Visual editor inserts extraneous blank lines (due to <nowiki/> pulled out of paragraph and then disappearing).Jun 27 2018, 3:30 PM
Vvjjkkii renamed this task from Visual editor inserts extraneous blank lines (due to <nowiki/> pulled out of paragraph and then disappearing) to lfaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from lfaaaaaaaa to Visual editor inserts extraneous blank lines (due to <nowiki/> pulled out of paragraph and then disappearing).Jul 2 2018, 10:36 AM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.
Deskana moved this task from To Triage to Freezer on the VisualEditor board.

The examples on this task so far have been mostly mistakes in syntax already present on the page, but per T212812, syntax like [[1823]]<nowiki/>an is not a mistake and quite common on Basque Wikipedia (https://eu.wikipedia.org/), so this issue appears more often there.

@matmarex I guess you are dealing with the matter. I bring the comment over from the other thread opened for the issues found in the Basque wikipedia.

For another clue, regardless of nowiki codes, I opened now the article Foruen amaiera Hego Euskal Herrian by clicking on "aldatu" (Visual Editor), and after loading it adds a parasitic blank line below the first paragraph in the article. Thanks

For another clue, regardless of nowiki codes, I opened now the article Foruen amaiera Hego Euskal Herrian by clicking on "aldatu" (Visual Editor), and after loading it adds a parasitic blank line below the first paragraph in the article. Thanks

I think this is a different problem (and arguably not a bug). The blank line here is a "slug", and it exists to allow inserting text between the image and the navigation box on the right.

image.png (980×1 px, 443 KB)

In this case it's a little useless, since because the image and the box are floating on the right, there is no visual difference between inserting text before, between or after them. But if they were shown without floating (e.g. on a narrow screen of a mobile phone), it would matter.

Regardless, this "slug" does not result in additional paragraphs being added to the wikitext of the page (unless you click it to add a paragraph).

ppelberg claimed this task.