Commit 2a1d4d54 by Chris Rodriguez

Updating video player controls with better accessibility

parent 721fffc9
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
'use strict'; 'use strict';
define('video/04_video_full_screen.js', [], function () { define('video/04_video_full_screen.js', [], function () {
var template = [ var template = [
'<button class="control add-fullscreen" aria-disabled="false">', '<button class="control add-fullscreen" aria-disabled="false" title="',
gettext('Fill browser'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-arrows-alt" aria-hidden="true"></span>', '<span class="icon fa fa-arrows-alt" aria-hidden="true"></span>',
'<span class="sr control-text">', '<span class="sr control-text">',
......
...@@ -7,7 +7,9 @@ define( ...@@ -7,7 +7,9 @@ define(
[], [],
function () { function () {
var template = [ var template = [
'<button class="control quality-control is-hidden" aria-disabled="false">', '<button class="control quality-control is-hidden" aria-disabled="false" title="',
gettext('High Definition'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon icon-hd" aria-hidden="true">HD</span>', // "HD" is treated as a proper noun '<span class="icon icon-hd" aria-hidden="true">HD</span>', // "HD" is treated as a proper noun
// Translator note: // Translator note:
......
...@@ -89,7 +89,7 @@ function () { ...@@ -89,7 +89,7 @@ function () {
'aria-valuemax': state.videoPlayer.duration(), 'aria-valuemax': state.videoPlayer.duration(),
'aria-valuemin': '0', 'aria-valuemin': '0',
'aria-valuenow': state.videoPlayer.currentTime, 'aria-valuenow': state.videoPlayer.currentTime,
'tabindex': '0' 'tabindex': '0',
'aria-label': gettext('Video position') 'aria-label': gettext('Video position')
}); });
......
...@@ -39,10 +39,13 @@ function() { ...@@ -39,10 +39,13 @@ function() {
template: [ template: [
'<div class="volume" role="application">', '<div class="volume" role="application">',
'<button class="control" aria-disabled="false" aria-label="', '<p class="sr instructions" id="volume-instructions">',
gettext('Volume: Click on this button to mute or unmute this video or press UP or ' + gettext('Click on this button to mute or unmute this video or press UP or DOWN buttons to increase or decrease volume level.'), // jshint ignore: line
'DOWN buttons to increase or decrease volume level.'), '</p>',
'" aria-expanded="false">', '<button class="control" aria-disabled="false" aria-describedby="volume-instructions"',
'" aria-expanded="false" title="',
gettext('Adjust video volume'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-volume-up" aria-hidden="true"></span>', '<span class="icon fa fa-volume-up" aria-hidden="true"></span>',
'<span class="sr control-text">', '<span class="sr control-text">',
......
...@@ -30,10 +30,13 @@ function (Iterator) { ...@@ -30,10 +30,13 @@ function (Iterator) {
SpeedControl.prototype = { SpeedControl.prototype = {
template: [ template: [
'<div class="speeds menu-container" role="application">', '<div class="speeds menu-container" role="application">',
'<button class="control speed-button" aria-label="', '<p class="sr instructions" id="speed-instructions">',
/* jshint maxlen:200 */ gettext('Press UP to enter the speed menu then use the UP and DOWN arrow keys to navigate the different speeds, then press ENTER to change to the selected speed.'), // jshint ignore: line
gettext('Speed: Press UP to enter the speed menu then use the UP and DOWN arrow keys to navigate the different speeds, then press ENTER to change to the selected speed.'), '</p>',
'" aria-disabled="false" aria-expanded="false">', '<button class="control speed-button" aria-disabled="false" aria-expanded="false"',
'title="',
gettext('Adjust video speed'),
'" aria-describedby="speed-instructions">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-caret-right" aria-hidden="true"></span>', '<span class="icon fa fa-caret-right" aria-hidden="true"></span>',
'<span class="sr control-text">', '<span class="sr control-text">',
......
...@@ -25,7 +25,9 @@ define('video/09_play_pause_control.js', [], function() { ...@@ -25,7 +25,9 @@ define('video/09_play_pause_control.js', [], function() {
PlayPauseControl.prototype = { PlayPauseControl.prototype = {
template: [ template: [
'<button class="control video_control play" aria-disabled="false">', '<button class="control video_control play" aria-disabled="false" title="',
gettext('Play'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-play" aria-hidden="true"></span>', '<span class="icon fa fa-play" aria-hidden="true"></span>',
'<span class="sr control-text">', '<span class="sr control-text">',
...@@ -77,6 +79,7 @@ define('video/09_play_pause_control.js', [], function() { ...@@ -77,6 +79,7 @@ define('video/09_play_pause_control.js', [], function() {
this.el this.el
.addClass('pause') .addClass('pause')
.removeClass('play') .removeClass('play')
.attr('title', gettext('Pause'))
.find('.icon') .find('.icon')
.removeClass('fa-play') .removeClass('fa-play')
.addClass('fa-pause'); .addClass('fa-pause');
...@@ -90,6 +93,7 @@ define('video/09_play_pause_control.js', [], function() { ...@@ -90,6 +93,7 @@ define('video/09_play_pause_control.js', [], function() {
this.el this.el
.removeClass('pause') .removeClass('pause')
.addClass('play') .addClass('play')
.attr('title', gettext('Play'))
.find('.icon') .find('.icon')
.removeClass('fa-pause') .removeClass('fa-pause')
.addClass('fa-play'); .addClass('fa-play');
......
...@@ -25,7 +25,9 @@ define('video/09_play_skip_control.js', [], function() { ...@@ -25,7 +25,9 @@ define('video/09_play_skip_control.js', [], function() {
PlaySkipControl.prototype = { PlaySkipControl.prototype = {
template: [ template: [
'<button class="control video_control play play-skip-control">', '<button class="control video_control play play-skip-control" title="',
gettext('Play'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-play" aria-hidden="true"></span>', '<span class="icon fa fa-play" aria-hidden="true"></span>',
'<span class="text control-text">', '<span class="text control-text">',
...@@ -78,6 +80,7 @@ define('video/09_play_skip_control.js', [], function() { ...@@ -78,6 +80,7 @@ define('video/09_play_skip_control.js', [], function() {
this.el this.el
.removeClass('play') .removeClass('play')
.addClass('skip') .addClass('skip')
.attr('title', gettext('Skip'))
.find('.icon') .find('.icon')
.removeClass('fa-play') .removeClass('fa-play')
.addClass('fa-step-forward') .addClass('fa-step-forward')
......
...@@ -28,7 +28,9 @@ function() { ...@@ -28,7 +28,9 @@ function() {
SkipControl.prototype = { SkipControl.prototype = {
template: [ template: [
'<button class="control video_control skip skip-control" aria-disabled="false">', '<button class="control video_control skip skip-control" aria-disabled="false" title="',
gettext('Do not show again'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-step-forward" aria-hidden="true"></span>', '<span class="icon fa fa-step-forward" aria-hidden="true"></span>',
'<span class="text control-text">', '<span class="text control-text">',
......
...@@ -95,7 +95,12 @@ ...@@ -95,7 +95,12 @@
'</span>', '</span>',
'</button>', '</button>',
'<div class="lang menu-container" role="application">', '<div class="lang menu-container" role="application">',
'<button class="control language-menu" aria-label="" aria-disabled="false">', '<p class="sr instructions" id="lang-instructions"></p>',
'<button class="control language-menu" aria-disabled="false"',
'aria-describedby="lang-instructions" ',
'title="',
gettext('Open language menu'),
'">',
'<span class="icon-fallback-img">', '<span class="icon-fallback-img">',
'<span class="icon fa fa-caret-left" aria-hidden="true"></span>', '<span class="icon fa fa-caret-left" aria-hidden="true"></span>',
'<span class="sr control-text"></span>', '<span class="sr control-text"></span>',
...@@ -759,8 +764,8 @@ ...@@ -759,8 +764,8 @@
self.subtitlesEl.find('.transcript-end') self.subtitlesEl.find('.transcript-end')
.text(gettext('End of transcript. Skip to the start.')); .text(gettext('End of transcript. Skip to the start.'));
self.container.find('.menu-container .language-menu') self.container.find('.menu-container .instructions')
.attr('aria-label', gettext('Language: Press the UP arrow key to enter the language menu then use UP and DOWN arrow keys to navigate language options. Press ENTER to change to the selected language.')); // jshint ignore:line .text(gettext('Press the UP arrow key to enter the language menu then use UP and DOWN arrow keys to navigate language options. Press ENTER to change to the selected language.')); // jshint ignore:line
self.container.find('.menu-container .control .control-text') self.container.find('.menu-container .control .control-text')
.text(gettext('Open language menu.')); .text(gettext('Open language menu.'));
...@@ -1115,6 +1120,7 @@ ...@@ -1115,6 +1120,7 @@
this.captionControlEl this.captionControlEl
.addClass('is-active') .addClass('is-active')
.attr('title', gettext('Hide closed captions'))
.find('.control-text') .find('.control-text')
.text(gettext('Hide closed captions')); .text(gettext('Hide closed captions'));
...@@ -1138,6 +1144,7 @@ ...@@ -1138,6 +1144,7 @@
this.captionControlEl this.captionControlEl
.removeClass('is-active') .removeClass('is-active')
.attr('title', gettext('Turn on closed captioning'))
.find('.control-text') .find('.control-text')
.text(gettext('Turn on closed captioning')); .text(gettext('Turn on closed captioning'));
...@@ -1194,6 +1201,7 @@ ...@@ -1194,6 +1201,7 @@
transcriptControlEl transcriptControlEl
.removeClass('is-active') .removeClass('is-active')
.attr('title', gettext(text))
.find('.control-text') .find('.control-text')
.text(gettext(text)); .text(gettext(text));
} else { } else {
...@@ -1207,6 +1215,7 @@ ...@@ -1207,6 +1215,7 @@
transcriptControlEl transcriptControlEl
.addClass('is-active') .addClass('is-active')
.attr('title', gettext(text))
.find('.control-text') .find('.control-text')
.text(gettext(text)); .text(gettext(text));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment