Page MenuHomePhabricator

VE's gallery representation differs enough so that selser is never applied?
Open, Needs TriagePublic

Description

Starting from,
https://en.wikipedia.org/w/index.php?title=User:Arlolra/sandbox&oldid=880024323

copy(ve.init.target.doc.body.outerHTML)

<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" about="#mwt3" data-mw="{&quot;name&quot;:&quot;gallery&quot;,&quot;attrs&quot;:{&quot;mode&quot;:&quot;packed&quot;},&quot;body&quot;:{}}" id="mwAg">
<li class="gallerybox" style="width: 202px;"><div class="thumb" style="width: 200px;"><figure-inline typeof="mw:Image"><a href="./File:Test.jpg"><img resource="./File:Test.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/300px-Name.jpg" data-file-width="350" data-file-height="210" data-file-type="bitmap" height="120" width="200" srcset="//upload.wikimedia.org/wikipedia/commons/5/5b/Name.jpg 2x, //upload.wikimedia.org/wikipedia/commons/5/5b/Name.jpg 1.5x"></a></figure-inline></div><div class="gallerytext">123</div></li>
</ul>

<p id="mwAw">456</p></body>

and making an edit to an unrelated portion of the page result in,

copy(ve.init.target.docToSave.body.outerHTML)

<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery" typeof="mw:Extension/gallery" data-mw="{&quot;name&quot;:&quot;gallery&quot;,&quot;attrs&quot;:{&quot;mode&quot;:&quot;packed&quot;},&quot;body&quot;:{}}" about="#mwt3" id="mwAg">
<li class="gallerybox" style="width: 202px;"><div><div class="thumb"><div><a><img resource="File:Test.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/300px-Name.jpg"></a></div></div></div><div class="gallerytext">123</div></li>
</ul>

<p id="mwAw">456</p><p id="mwAw">789</p></body>

For one, the class list changed.

The internal structure from,
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/6291dff109f4a04ed1432e78234b7db34dc7d9eb/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js#L90-L96

doesn't match the spec,
https://www.mediawiki.org/wiki/Specs/HTML/2.0.0/Extensions/Gallery

For a while, this was just causing attribute normalization,
https://phabricator.wikimedia.org/T211246#4829298

because the "extsrc" was present so the body would be serialized from that.

In https://github.com/wikimedia/parsoid/commit/e748b8ec831bf6c86487ca8e551274d62be16b1d, that was removed and now the normalizations are getting a little more drastic,
https://en.wikipedia.org/w/index.php?title=Kashubian_language&curid=17254&diff=880004780&oldid=879154010&diffmode=source .

That was reverted in https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/486395

However, there's a hitch. Parsoid doesn't have special handling for galleries in selser so fixing this would cause edits to disappear (for the details, see T214648).

Details

Related Gerrit Patches:

Event Timeline

Arlolra created this task.Jan 24 2019, 10:23 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 24 2019, 10:23 PM

Change 486395 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Revert "Get rid of nativeGallery option and enable it by default"

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

Arlolra updated the task description. (Show Details)Jan 24 2019, 11:02 PM

Change 486395 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Revert "Get rid of nativeGallery option and enable it by default"

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

Mentioned in SAL (#wikimedia-operations) [2019-01-25T00:01:06Z] <arlolra> Updated Parsoid to 4772f44 (T214649, T214648)

JTannerWMF moved this task from To Triage to FY 19-20 on the VisualEditor board.Mar 12 2019, 3:57 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMar 12 2019, 3:58 PM

Adding the regression tag as the bug happens now on every edit with a gallery tag since December 4th 2019, see duplicate task T239783.