Skip to content

Commit 9a8376e

Browse files
smbeagkatsev
authored andcommitted
fix(remaining-time-display): make the '-' be visual and not readable by screen readers (videojs#5671)
Fixes videojs#5168
1 parent 3e3387f commit 9a8376e

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

src/js/control-bar/time-controls/remaining-time-display.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*/
44
import TimeDisplay from './time-display';
55
import Component from '../../component.js';
6+
import * as Dom from '../../utils/dom.js';
7+
68
/**
79
* Displays the time left in the video
810
*
@@ -36,19 +38,16 @@ class RemainingTimeDisplay extends TimeDisplay {
3638
}
3739

3840
/**
39-
* The remaining time display prefixes numbers with a "minus" character.
40-
*
41-
* @param {number} time
42-
* A numeric time, in seconds.
41+
* Create the `Component`'s DOM element with the "minus" characted prepend to the time
4342
*
44-
* @return {string}
45-
* A formatted time
46-
*
47-
* @private
43+
* @return {Element}
44+
* The element that was created.
4845
*/
49-
formatTime_(time) {
50-
// TODO: The "-" should be decorative, and not announced by a screen reader
51-
return '-' + super.formatTime_(time);
46+
createEl() {
47+
const el = super.createEl();
48+
49+
el.insertBefore(Dom.createEl('span', {}, {'aria-hidden': true}, '-'), this.contentEl_);
50+
return el;
5251
}
5352

5453
/**

src/js/control-bar/time-controls/time-display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TimeDisplay extends Component {
3535
* @return {Element}
3636
* The element that was created.
3737
*/
38-
createEl(plainName) {
38+
createEl() {
3939
const className = this.buildCSSClass();
4040
const el = super.createEl('div', {
4141
className: `${className} vjs-time-control vjs-control`,

src/js/utils/fn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const bind = function(context, fn, uid) {
5555
* @param {Function} fn
5656
* The function to be throttled.
5757
*
58-
* @param {Number} wait
58+
* @param {number} wait
5959
* The number of milliseconds by which to throttle.
6060
*
6161
* @return {Function}

src/js/utils/url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const getAbsoluteURL = function(url) {
126126
* @param {string} path
127127
* The fileName path like '/path/to/file.mp4'
128128
*
129-
* @returns {string}
129+
* @return {string}
130130
* The extension in lower case or an empty string if no
131131
* extension could be found.
132132
*/

0 commit comments

Comments
 (0)