mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Make image list keyboard accessible in gallery dialog
Bug: T140874 Change-Id: I0f00f1ddb397fb8f543a04d62b94fc5db32180f6
This commit is contained in:
parent
e7a3451931
commit
7d4864729b
|
@ -34,8 +34,12 @@ ve.ui.MWGalleryItemWidget = function VeUiMWGalleryItemWidget( imageInfo, config
|
||||||
|
|
||||||
// Mixin constructors
|
// Mixin constructors
|
||||||
OO.ui.mixin.DraggableElement.call( this, ve.extendObject( { $handle: this.$element }, this.config ) );
|
OO.ui.mixin.DraggableElement.call( this, ve.extendObject( { $handle: this.$element }, this.config ) );
|
||||||
|
OO.ui.mixin.TabIndexedElement.call( this, config );
|
||||||
|
|
||||||
this.$element.on( 'click', this.onItemClick.bind( this ) );
|
this.$element.on( {
|
||||||
|
click: this.onItemClick.bind( this ),
|
||||||
|
keypress: this.onItemKeyPress.bind( this )
|
||||||
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Inheritance */
|
/* Inheritance */
|
||||||
|
@ -43,6 +47,7 @@ ve.ui.MWGalleryItemWidget = function VeUiMWGalleryItemWidget( imageInfo, config
|
||||||
OO.inheritClass( ve.ui.MWGalleryItemWidget, OO.ui.Widget );
|
OO.inheritClass( ve.ui.MWGalleryItemWidget, OO.ui.Widget );
|
||||||
|
|
||||||
OO.mixinClass( ve.ui.MWGalleryItemWidget, OO.ui.mixin.DraggableElement );
|
OO.mixinClass( ve.ui.MWGalleryItemWidget, OO.ui.mixin.DraggableElement );
|
||||||
|
OO.mixinClass( ve.ui.MWGalleryItemWidget, OO.ui.mixin.TabIndexedElement );
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
|
|
||||||
|
@ -59,6 +64,18 @@ ve.ui.MWGalleryItemWidget.prototype.onItemClick = function () {
|
||||||
this.emit( 'edit', this );
|
this.emit( 'edit', this );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle key press events
|
||||||
|
*
|
||||||
|
* @param {jQuery.Event} e Key press event
|
||||||
|
*/
|
||||||
|
ve.ui.MWGalleryItemWidget.prototype.onItemKeyPress = function ( e ) {
|
||||||
|
if ( e.which === OO.ui.Keys.ENTER ) {
|
||||||
|
this.emit( 'edit', this );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the caption property
|
* Set the caption property
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue