Page MenuHomePhabricator

Gallery with no images (invalid characters as gallery contents) creates an invisible node and can't be edited
Closed, ResolvedPublic1 Estimated Story Points

Description

Gallery with no images (invalid characters as gallery contents) creates an invisible node and can't be edited.

For example, create a page with the following wikitext:

<gallery>
>>
</gallery>

Example: https://en.wikipedia.org/w/index.php?title=User:Matma_Rex/sandbox&oldid=826934821

This renders as an empty gallery (<ul class="gallery mw-gallery-traditional"></ul>).

In VE, it displays a placeholder, but it seems that it can't be clicked to focus it:


When focussed using arrow keys, it displays a completely mispositioned context menu:

Trying to use the "Edit" button causes a JS error in the console:

TypeError: Cannot read property 'toggleHighlighted' of undefined
    at VeUiMWGalleryDialog.ve.ui.MWGalleryDialog.onHighlightItem (https://en.wikipedia.org/w/extensions/VisualEditor/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js?22058:591:7)
    at https://en.wikipedia.org/w/extensions/VisualEditor/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js?22058:342:13
    at fire (https://en.wikipedia.org/w/load.php?debug=true&lang=en&modules=jquery%2Cmediawiki%7Cmediawiki.legacy.wikibits&only=scripts&skin=vector&version=14kbqyi:3317:31)
    at Object.add [as done] (https://en.wikipedia.org/w/load.php?debug=true&lang=en&modules=jquery%2Cmediawiki%7Cmediawiki.legacy.wikibits&only=scripts&skin=vector&version=14kbqyi:3376:7)
    at VeUiMWGalleryDialog.<anonymous> (https://en.wikipedia.org/w/extensions/VisualEditor/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js?22058:341:9)
    at https://en.wikipedia.org/w/resources/lib/oojs-ui/oojs-ui-windows.js?f9a29:748:28
    at mightThrow (https://en.wikipedia.org/w/load.php?debug=true&lang=en&modules=jquery%2Cmediawiki%7Cmediawiki.legacy.wikibits&only=scripts&skin=vector&version=14kbqyi:3583:29)
    at process (https://en.wikipedia.org/w/load.php?debug=true&lang=en&modules=jquery%2Cmediawiki%7Cmediawiki.legacy.wikibits&only=scripts&skin=vector&version=14kbqyi:3651:12)

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:46 AM
bzimport set Reference to bz73230.

Confirmed.

In addition to the scenario described abotve:

If ">>" is entered - the gallery will be saved as

<gallery>

</gallery>

If, say, "caption", will be surrounded with << and >>, then the inserted Gallery becomes invisible, but in Edit source it will be:

<gallery>
<<Caption>>
</gallery>

Etonkovidova set Security to None.
matmarex renamed this task from VisualEditor:[Regression wmf7] Invalid characters as gallery caption, creates an empty node. to Gallery with no images (invalid characters as gallery contents) creates an invisible node and can't be edited.Feb 21 2018, 8:42 PM
matmarex updated the task description. (Show Details)
matmarex added a subscriber: matmarex.

This is not reproducible as originally written, due to changes in the gallery inspector, but a similar issue is still present. I updated the description.

Change 413252 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.ui.MWGalleryDialog: Handle galleries with 0 items

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

Change 413253 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.ce.MWGalleryNode: Ensure we always have a focusable element

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

Change 413252 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ve.ui.MWGalleryDialog: Handle galleries with 0 items

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

Change 413253 merged by Jforrester:
[mediawiki/extensions/VisualEditor@master] ve.ce.MWGalleryNode: Ensure we always have a focusable element

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

Deskana set the point value for this task to 1.