mediawiki-extensions-Revisi.../modules/ext.RevisionSlider.lazy.js
gopavasanth 548019e16d Added keypress() to mw-revslider-toggle-button
On tapping Enter or Space the Rev-Slider Opens

Bug: T199212
Change-Id: I08ab018c3e89d25ab8d4e72963e9cbd4971f7068
2018-08-29 16:07:18 +00:00

22 lines
554 B
JavaScript

( function ( mw, $ ) {
var settings = new mw.libs.revisionSlider.Settings(),
autoExpand = settings.shouldAutoExpand();
if ( autoExpand ) {
mw.loader.load( 'ext.RevisionSlider.init' );
} else {
$( '.mw-revslider-toggle-button' ).click(
function () {
mw.loader.load( 'ext.RevisionSlider.init' );
}
);
}
$( '.mw-revslider-toggle-button' ).keypress( function ( event ) {
if ( event.which === 13 || event.which === 32 ) {
event.preventDefault();
$( '.mw-revslider-toggle-button' ).click();
}
} );
}( mediaWiki, jQuery ) );