mirror of
https://github.com/videojs/video.js.git
synced 2025-01-04 06:48:49 +02:00
Provide additional information for screen reader users on the status of the volume bar diff --git a/src/js/controls.js b/src/js/controls.js
index 2d5ad21..bb050b9 100644 Signed-off-by: Greg Kraus <gdkraus@ncsu.edu>
This commit is contained in:
parent
1d6e93d990
commit
00a508508e
11
src/js/controls.js
vendored
11
src/js/controls.js
vendored
@ -792,9 +792,17 @@ vjs.VolumeControl.prototype.createEl = function(){
|
||||
*/
|
||||
vjs.VolumeBar = function(player, options){
|
||||
goog.base(this, player, options);
|
||||
player.on('volumechange', vjs.bind(this, this.updateARIAAttributes));
|
||||
player.ready(vjs.bind(this, this.updateARIAAttributes));
|
||||
};
|
||||
goog.inherits(vjs.VolumeBar, vjs.Slider);
|
||||
|
||||
vjs.VolumeBar.prototype.updateARIAAttributes = function(){
|
||||
// Current value of volume bar as a percentage
|
||||
this.el_.setAttribute('aria-valuenow',vjs.round(this.player_.volume()*100, 2));
|
||||
this.el_.setAttribute('aria-valuetext',vjs.round(this.player_.volume()*100, 2)+'%');
|
||||
};
|
||||
|
||||
vjs.VolumeBar.prototype.options_ = {
|
||||
children: {
|
||||
'volumeLevel': {},
|
||||
@ -808,7 +816,8 @@ vjs.VolumeBar.prototype.playerEvent = 'volumechange';
|
||||
|
||||
vjs.VolumeBar.prototype.createEl = function(){
|
||||
return goog.base(this, 'createEl', 'div', {
|
||||
className: 'vjs-volume-bar'
|
||||
className: 'vjs-volume-bar',
|
||||
'aria-label': 'volume level'
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user