Page MenuHomePhabricator

VisualEditor: Removing spaces between successive citations causes them to jump to a new line (in editor, not in output)
Open, Needs TriagePublic

Assigned To
None
Authored By
SUM1
Mar 11 2020, 8:50 AM
Referenced Files
F31676163: image.png
Mar 11 2020, 8:50 AM
F31676161: image.png
Mar 11 2020, 8:50 AM
F31676166: image.png
Mar 11 2020, 8:50 AM

Description

Issue started around early February 2020 (don't know exact date). Does not seem to occur with any templates. Occurs on at least the English and French Wikipedias.

Steps to reproduce:

  1. Edit a page in VisualEditor on a wiki that supports adding citations (in <ref> tags).
  2. Find two or more citations next to each other, or create them.

image.png (45×74 px, 1 KB)

  1. Add a space or a carriage return between each citation.

image.png (43×81 px, 1 KB)

  1. Switch to the source editor.
  2. Switch back.
  3. Now remove one of the spaces.

Actual result:

The citation after the removed space jumps to a new line, and you cannot put it back on its original line by backspacing or deleting the "new lines".

image.png (71×576 px, 7 KB)

This is only in the editor; saving the page will keep them on the same line.

This is easily fixed by specifically clicking in a paragraph other than the one containing the citations. The citations will then jump back to their original position.

Expected result:

The space or carriage return is simply removed.

Event Timeline

matmarex subscribed.

This looks to be a change in the behavior of contenteditable in Chromium (I'd say it's a browser bug, but the behavior of contenteditable is not exactly well-specified). There's a <br> node in the DOM that is not in our data model, and we definitely don't insert such nodes ourselves.

I can't reproduce the bug in Firefox or Internet Explorer. I can reproduce using Chrome/80.0.3987.100

Still reproducible today in Chrome 112.0.5615.20.

matmarex renamed this task from VisualEditor: Since around February 2020, removing spaces between successive citations causes them to jump to a new line (in editor, not in output) to VisualEditor: Removing spaces between successive citations causes them to jump to a new line (in editor, not in output).Apr 13 2023, 3:06 AM