Merge "Improve support for screenreaders"

This commit is contained in:
jenkins-bot 2017-06-27 11:23:27 +00:00 committed by Gerrit Code Review
commit ef2604f00f
3 changed files with 37 additions and 7 deletions

View file

@ -24,20 +24,28 @@
width: 200,
classes: [ 'mw-revslider-tooltip', 'mw-revslider-help-tooltip' ]
} );
helpButton.connect( this, {
click: 'showDialog'
} );
helpButton.$element
.click( function () {
mw.libs.revisionSlider.HelpDialog.show();
} )
.mouseover( function () {
helpPopup.toggle( true );
} )
.mouseout( function () {
helpPopup.toggle( false );
} )
.children().attr( {
'aria-haspopup': 'true',
'aria-label': mw.msg( 'revisionslider-show-help-tooltip' )
} );
$( 'body' ).append( helpPopup.$element );
return helpButton.$element;
},
showDialog: function () {
mw.libs.revisionSlider.HelpDialog.show();
}
};

View file

@ -47,6 +47,7 @@
backwardArrowButton.$element
.attr( 'data-dir', -1 )
.children().attr( 'aria-label', mw.msg( 'revisionslider-arrow-tooltip-older' ) )
.mouseover( { button: backwardArrowButton, popup: backwardArrowPopup }, this.showPopup )
.mouseout( { popup: backwardArrowPopup }, this.hidePopup )
.focusin( { button: backwardArrowButton }, this.arrowFocusHandler );
@ -88,6 +89,7 @@
forwardArrowButton.$element
.attr( 'data-dir', 1 )
.children().attr( 'aria-label', mw.msg( 'revisionslider-arrow-tooltip-newer' ) )
.mouseover( { button: forwardArrowButton, popup: forwardArrowPopup }, this.showPopup )
.mouseout( { popup: forwardArrowPopup }, this.hidePopup )
.focusin( { button: forwardArrowButton }, this.arrowFocusHandler );

View file

@ -8,6 +8,11 @@
var startTime = mw.now(),
api = new mw.libs.revisionSlider.Api( mw.util.wikiScript( 'api' ) );
toggleButton.$element.children().attr( {
'aria-expanded': autoExpand,
'aria-controls': 'mw-revslider-slider-wrapper'
} );
mw.track( 'counter.MediaWiki.RevisionSlider.event.init' );
mw.libs.revisionSlider.userOffset = mw.user.options.get( 'timecorrection' ) ? mw.user.options.get( 'timecorrection' ).split( '|' )[ 1 ] : mw.config.get( 'extRevisionSliderTimeOffset' );
@ -29,6 +34,7 @@
revs.reverse();
$container = $( '.mw-revslider-slider-wrapper' );
$container.attr( 'id', 'mw-revslider-slider-wrapper' );
revisionList = new mw.libs.revisionSlider.RevisionList( mw.libs.revisionSlider.makeRevisions( revs ) );
revisionList.getView().setDir( $container.css( 'direction' ) || 'ltr' );
@ -66,6 +72,7 @@
$( '.mw-revslider-container' ).removeClass( 'mw-revslider-container-collapsed' )
.addClass( 'mw-revslider-container-expanded' );
$( '.mw-revslider-slider-wrapper' ).show();
toggleButton.$element.children().attr( 'aria-expanded', 'true' );
expanded = true;
},
@ -74,28 +81,41 @@
$( '.mw-revslider-container' ).removeClass( 'mw-revslider-container-expanded' )
.addClass( 'mw-revslider-container-collapsed' );
$( '.mw-revslider-slider-wrapper' ).hide();
toggleButton.$element.children().attr( 'aria-expanded', 'false' );
};
autoExpandButton = new OO.ui.ToggleButtonWidget( {
icon: 'pin',
classes: [ 'mw-revslider-auto-expand-button' ],
title: mw.message( autoExpand ?
title: mw.msg( autoExpand ?
'revisionslider-turn-off-auto-expand-title' :
'revisionslider-turn-on-auto-expand-title'
).text(),
),
value: autoExpand
} );
autoExpandButton.$element.children().attr(
'aria-label',
mw.msg( autoExpand ?
'revisionslider-turn-off-auto-expand-title' :
'revisionslider-turn-on-auto-expand-title'
) );
autoExpandButton.connect( this, {
click: function () {
autoExpand = !autoExpand;
settings.setAutoExpand( autoExpand );
if ( autoExpand ) {
autoExpandButton.setTitle( mw.message( 'revisionslider-turn-off-auto-expand-title' ).text() );
autoExpandButton.setTitle( mw.msg( 'revisionslider-turn-off-auto-expand-title' ) );
autoExpandButton.$element.children().attr(
'aria-label', mw.msg( 'revisionslider-turn-off-auto-expand-title' )
);
expand();
mw.track( 'counter.MediaWiki.RevisionSlider.event.autoexpand_on' );
} else {
autoExpandButton.setTitle( mw.message( 'revisionslider-turn-on-auto-expand-title' ).text() );
autoExpandButton.setTitle( mw.msg( 'revisionslider-turn-on-auto-expand-title' ) );
autoExpandButton.$element.children().attr(
'aria-label', mw.msg( 'revisionslider-turn-on-auto-expand-title' )
);
mw.track( 'counter.MediaWiki.RevisionSlider.event.autoexpand_off' );
}
}