Page MenuHomePhabricator

VisualEditor breaks galleries with <br /> in image captions
Closed, ResolvedPublic

Description

As reported on the German-language Wikipedia's feedback page, editing a gallery which has <br /> linebreaks within the image captions destroys the gallery.

An example of how to reproduce the problem is given here.

Enforcing line-breaks within the captions using <br /> might not be allowed within gallery captions, but it works well and is therefore used by editors. Even if VE does not support adding linebreaks, it should not destroy already existing galleries when users edit the page.

Event Timeline

Cirdan created this task.Apr 3 2018, 7:24 AM
Restricted Application added a project: Multimedia. · View Herald TranscriptApr 3 2018, 7:24 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Cirdan updated the task description. (Show Details)Apr 3 2018, 7:28 AM
Deskana added a subscriber: Deskana.Apr 3 2018, 6:41 PM

So, this clearly shouldn't happen, and the visual editor is mangling the wikitext. But, at the same time, putting a line break in an image caption is almost always a bad idea. Different people have different font sizes, screen sizes, resolutions, and so on, and all of this means that trying to force line breaks to appear in particular spots in a size-constrained element of a web page is recipe for disaster and cause a lot of unpredictability for readers.

Esanders added a subscriber: Esanders.

This appears to be a Parsoid bug. Captions with a <br> don't round-trip cleanly (if data-parsoid.body is empty).

Arlolra claimed this task.Apr 4 2018, 4:13 PM
Arlolra triaged this task as Normal priority.

Change 423984 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Serialize gallery image captions in single line context

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

Ramsey-WMF moved this task from Untriaged to Tracking on the Multimedia board.Apr 4 2018, 5:16 PM
Cirdan added a comment.Apr 4 2018, 8:33 PM

But, at the same time, putting a line break in an image caption is almost always a bad idea.

I agree, but as long as <gallery> permits the use of line breaks, the VE needs to as well. Perhaps <gallery> can be restricted to plain text with only basic formatting (bold, italics, link)?

Change 423984 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Serialize gallery image captions in single line context

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

Arlolra closed this task as Resolved.Apr 5 2018, 3:07 PM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptApr 5 2018, 3:07 PM

Mentioned in SAL (#wikimedia-operations) [2018-04-09T20:48:08Z] <arlolra> Updated Parsoid to edeeb60 (T191281, T187386, T185266)