MWTransclusionDialog: Set 'aria-expanded' on "Show/hide options" button

Adding the ability for screen reader to announce 
the state of the Transclusion dialog 
when the show/hide options button is clicked.

Bug: T248089
Change-Id: I89b86179bcb63376e480cb8df55e24b9d29df037
This commit is contained in:
Akinwale Alagbe 2020-03-19 06:39:53 -07:00 committed by Bartosz Dziewoński
parent cae5f665b8
commit 2aeae1c3f9

View file

@ -256,11 +256,16 @@ ve.ui.MWTransclusionDialog.prototype.updateModeActionState = function () {
var parts = this.transclusionModel && this.transclusionModel.getParts(),
mode = this.mode;
this.actions.forEach( { actions: [ 'mode' ] }, function ( action ) {
action.setLabel(
mode === 'single' ?
ve.msg( 'visualeditor-dialog-transclusion-multiple-mode' ) :
ve.msg( 'visualeditor-dialog-transclusion-single-mode' )
);
var label, expanded;
if ( mode === 'single' ) {
label = ve.msg( 'visualeditor-dialog-transclusion-multiple-mode' );
expanded = false;
} else {
label = ve.msg( 'visualeditor-dialog-transclusion-single-mode' );
expanded = true;
}
action.setLabel( label );
action.$button.attr( 'aria-expanded', expanded.toString() );
} );
// Decide whether the button should be enabled or not. It needs to be: