mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Set selected status to sidebar elements
ARIA-selected only works on specific elements/roles. I tried several combinations here, the most fitting seemed to be the option role, but that role did not work very well in FF with NVDA. It also should only be used as direct child to a listbox e.g. with several children. The next role that's working with ARIA-selected that seemed fitting is the gridcell. It's still a bit hacky but works well in IE and FF with NVDA. I suspect that that's pretty good coverage already then. Bug: T291284 Change-Id: I85c865b0ab12d3923e472e5f36b5c07b7c722180
This commit is contained in:
parent
597bacd63b
commit
ef57268b2e
|
@ -27,6 +27,12 @@ ve.ui.MWTransclusionOutlineButtonWidget = function VeUiMWTransclusionOutlineButt
|
|||
$tabIndexed: this.$button
|
||||
}, config ) );
|
||||
|
||||
// FIXME hack for screen readers to understand the selection state
|
||||
this.$button.attr( {
|
||||
role: 'gridcell',
|
||||
'aria-selected': 'false'
|
||||
} );
|
||||
|
||||
this.$element
|
||||
.append( this.$button.append( this.$icon, this.$label ) );
|
||||
};
|
||||
|
@ -86,3 +92,14 @@ ve.ui.MWTransclusionOutlineButtonWidget.prototype.onKeyDown = function ( e ) {
|
|||
|
||||
return OO.ui.mixin.ButtonElement.prototype.onKeyDown.call( this, e );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ve.ui.MWTransclusionOutlineButtonWidget.prototype.setSelected = function ( state ) {
|
||||
if ( this.$button ) {
|
||||
this.$button.attr( 'aria-selected', state.toString() );
|
||||
}
|
||||
|
||||
return ve.ui.MWTransclusionOutlineButtonWidget.super.prototype.setSelected.call( this, state );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue