Skip to content

Commit

Permalink
Remove spaces from element IDs and ARIA attributes in the Captions Se…
Browse files Browse the repository at this point in the history
…ttings Dialog (fixes videojs#4688 and videojs#4884)
  • Loading branch information
OwenEdwards committed May 8, 2018
1 parent 0f1268e commit 5d1c840
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/js/tracks/text-track-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,19 +313,20 @@ class TextTrackSettings extends ModalDialog {
createElSelect_(key, legendId = '', type = 'label') {
const config = selectConfigs[key];
const id = config.id.replace('%s', this.id_);
const selectLabelledbyIds = [legendId, id].join(' ').trim();

return [
`<${type} id="${id}" class="${type === 'label' ? 'vjs-label' : ''}">`,
this.localize(config.label),
`</${type}>`,
`<select aria-labelledby="${legendId !== '' ? legendId + ' ' : ''}${id}">`
`<select aria-labelledby="${selectLabelledbyIds}">`
].
concat(config.options.map(o => {
const optionId = id + '-' + o[1];
const optionId = id + '-' + o[1].replace(/\W+/g, '');

return [
`<option id="${optionId}" value="${o[0]}" `,
`aria-labelledby="${legendId !== '' ? legendId + ' ' : ''}${id} ${optionId}">`,
`aria-labelledby="${selectLabelledbyIds} ${optionId}">`,
this.localize(o[1]),
'</option>'
].join('');
Expand Down

0 comments on commit 5d1c840

Please sign in to comment.