ve.ce.MWGalleryNode: Ensure we always have a focusable element

For galleries with 0 items, this would previously return an empty
jQuery collection, which caused funny rendering issues later.

Bug: T75230
Change-Id: Ia68e4f1b74b5ec494fa3d86f0b792f69eadb02fb
This commit is contained in:
Bartosz Dziewoński 2018-02-21 22:22:49 +01:00
parent 3d422bac2a
commit a5e2f60d7e

View file

@ -38,8 +38,8 @@ ve.ce.MWGalleryNode.static.primaryCommandName = 'gallery';
* @inheritdoc ve.ce.GeneratedContentNode
*/
ve.ce.MWGalleryNode.prototype.getFocusableElement = function () {
var $gallery = this.$element.find( '.gallery' ).addBack( '.gallery' );
return $gallery.length ? $gallery.children() : this.$element;
var $gallery = this.$element.find( '.gallery' ).addBack( '.gallery' ).children();
return $gallery.length ? $gallery : this.$element;
};
/**