- Create or edit a list with one or more items.
- Press shift-enter within the list item's text and then enter some more text.
- Observe that within the surface, the list item now has text over multiple lines. (correct, as expected)
- Save, Or review wikitext diff.
Actual result:
Line break was stripped away and is no longer text. Text unexpectedly now renders next to each other.
Screenshots:
Text entered | Line break added |
---|---|
Visual diff | Wikitext diff |
---|---|
Here the problem is visible. | |
Other information:
While merely an internal detail, I notice that when pressing shift-enter, VisualEditor actually split the list item into two paragraphs - instead of like it did before, which was to internally use a <br> element.
This is significant because when serialising the visual page to Wikitext, we default to the double-linebreak syntax for paragraphs, which is not allowed in list items in Wikitext (because it would end the * bullet list).
On the other hand, serialising <br> is perfectly valid in wikitext.
The following related scenario does work:
- Edit a page with a wikitext editor.
- Create a regular paragraph and insert <br> in-between two pieces of text.
- Create a list with <br> in-between two pieces of text in the lit item.
- Save
- Edit with VisualEditor.
- Observe the line break is rendered just fine. Both in paragraphs and in the list. VisualEditor can render it, edit it, and save/roundtrip.
I also observe that in regular paragraphs, VisualEditor also uses P instead of BR on shift-enter. I do not know if that was changed intentionally. I suppose the difference is small enough that it may be an intentional style decision. However, for list items that is a problem.
I propose three possible ideas as solution:
- Make shift-enter insert BR always like before. Enter is not a problem in list items because that adds a new list item, not a paragraph.
- Make shift-enter insert BR for list items and P elsewhere.
- Make Parsoid serialise paragraphs in list items correctly (e.g. using ugly <p> syntax).
It seems that 1 or 2 would be preferred because a paragraph creates more spacing in a list item than intended. The use of shift-enter is commonly used in different software for the insertion of line breaks (as opposed to new items/paragraphs).
Regression
I don't recall when this last worked, but this definitely worked at some point (it inserted BR for shift-enter). Could be a couple weeks, or maybe even a month or two.