Skip to content

Fix time-display.js to restore hidden label text for screen readers. Fixes #5135#5157

Merged
gkatsev merged 5 commits into
videojs:6.xfrom
OwenEdwards:fix/label-time-display-for-screen-readers
May 11, 2018
Merged

Fix time-display.js to restore hidden label text for screen readers. Fixes #5135#5157
gkatsev merged 5 commits into
videojs:6.xfrom
OwenEdwards:fix/label-time-display-for-screen-readers

Conversation

@OwenEdwards

Copy link
Copy Markdown
Member

Description

Fix time-display.js to restore hidden label text for screen readers. Fixes #5135

Specific Changes proposed

Also, fix a typo in translations-needed.md, and add a space in the hidden label for live-display, so that it doesn't run together with the visible "LIVE" indication.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
  • Reviewed by Two Core Contributors

…ixes videojs#5135

Also, fix a typo in translations-needed.md, and add a space in the hidden label for
 live-display, so that it doesn't run together with the visible "LIVE" indication.
@OwenEdwards OwenEdwards requested a review from gkatsev May 9, 2018 02:36
@OwenEdwards OwenEdwards added a11y This item might affect the accessibility of the player 6.x labels May 9, 2018
Comment thread lang/en.json
"Pause": "Pause",
"Replay": "Replay",
"Current Time": "Current Time",
"Duration Time": "Duration Time",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, looking at the translations, most of them just translated 'Duration', so, I wonder whether we should just leave this as is? Or add Duration as a second option and then where we use it in the code we first try Duration localization and then Duration Time localization.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Duration Time" sounds like something poorly translated into English ;-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, makes sense, just thinking about how to reduce need for re-working all the translations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just change it to "Duration" in this and all the other language files, and then note some of the translations may be incorrect? It seems like translations get fixed as much as they get added to?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, maybe that's just the best choice.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread src/js/control-bar/live-display.js Outdated
this.contentEl_ = Dom.createEl('div', {
className: 'vjs-live-display',
innerHTML: `<span class="vjs-control-text">${this.localize('Stream Type')}</span>${this.localize('LIVE')}`
innerHTML: `<span class="vjs-control-text">${this.localize('Stream Type')}&nbsp;</span>${this.localize('LIVE')}`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use the unicode representation (\u00a0) for xhtml safety #4825

* @type {string}
* @private
*/
CurrentTimeDisplay.prototype.controlText_ = 'Current Time';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should leave the controlText_ property in case anyone is relying on it but internally ignore it and only use labelText_

@OwenEdwards OwenEdwards May 10, 2018

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's confusing, because these components don't extend Button or ClickableComponent which do have that concept of controlText_, and because these aren't controls, they're information displays.

It looks like controlText_ was added when the common time-display.js was created. Which version was that? If it wasn't 6.0, then it doesn't seem like anyone ought to be "relying on it", since it's private.

* @private
*/
formatTime_(time) {
// TODO: The "-" should be decorative, and not announced by a screen reader

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because the screen reader would announce something like "remaining time minus 5:00" as it is currently?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. The "-" is a visual convention, but the actual amount of time remaining is not negative. It's a small detail, which is why I didn't fix it now, but it ought to be fixed in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably open an issue so we don't forget

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: see #5168.

});

this.contentEl_ = Dom.createEl('div', {
this.contentEl_ = Dom.createEl('span', {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably fine to make, but I'd like to take a look at the output first.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use a <div>, JAWS treats the content label and the time as two separate things, so you need to press the arrow key to move between them in Virtual Cursor mode. With a <span>, JAWS treats them as a single thing (hence the need to be careful about adding a space in certain places with spans).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I don't see any issues with this change once trying it out.

…update translations-needed.md

Note that some translations of "Duration" may need updating, where the translation of "Duration Time" is not equivalent.
@OwenEdwards

OwenEdwards commented May 11, 2018

Copy link
Copy Markdown
Member Author

@gkatsev is this what you were thinking as far as leaving the controlText_ property but not using it?

@gkatsev

gkatsev commented May 11, 2018

Copy link
Copy Markdown
Member

yup, thanks @OwenEdwards!

@gkatsev gkatsev merged commit baa6b56 into videojs:6.x May 11, 2018
gkatsev pushed a commit that referenced this pull request May 11, 2018
Restore hidden label text for screen readers that describes what the button control does.

Renames the Duration Time language item to Duration.

Deprecate controlText_ property.

Fix a typo in translations-needed.md.

Add a space in the hidden label for live-display, so that it doesn't run together with the visible "LIVE" indication.

Fixes #5135
@OwenEdwards OwenEdwards deleted the fix/label-time-display-for-screen-readers branch May 14, 2018 16:22
@OwenEdwards OwenEdwards restored the fix/label-time-display-for-screen-readers branch May 14, 2018 16:34
@OwenEdwards OwenEdwards deleted the fix/label-time-display-for-screen-readers branch May 14, 2018 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.x a11y This item might affect the accessibility of the player confirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants