Skip to content

Commit

Permalink
Bug mediaelement#1397, Fix for screen reader accessibility of captions (
Browse files Browse the repository at this point in the history
mediaelement#1340)

* Add a flag, so captions are not a WAI-ARIA live region by default
* Relates to mediaelement#1262
  • Loading branch information
nfreear committed Jan 11, 2015
1 parent f21fce8 commit 2ee409e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/js/mep-feature-tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

tracksText: mejs.i18n.t('Captions/Subtitles'),

// By default, no WAI-ARIA live region - don't make a
// screen reader speak captions over an audio track.
tracksAriaLive: false,

// option to remove the [cc] button when no <track kind="subtitles"> are present
hideCaptionsButtonWhenEmpty: true,

Expand All @@ -26,6 +30,8 @@
return;

var t = this,
attr = t.options.tracksAriaLive ?
'role="log" aria-live="assertive" aria-atomic="false"' : '',
i,
options = '';

Expand All @@ -38,7 +44,8 @@
$('<div class="mejs-chapters mejs-layer"></div>')
.prependTo(layers).hide();
player.captions =
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" role="log" aria-live="assertive" aria-atomic="false"><span class="mejs-captions-text"></span></div></div>')
$('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" ' +
attr + '><span class="mejs-captions-text"></span></div></div>')
.prependTo(layers).hide();
player.captionsText = player.captions.find('.mejs-captions-text');
player.captionsButton =
Expand Down

0 comments on commit 2ee409e

Please sign in to comment.