Skip to content

Commit

Permalink
fix: Remove spaces from element IDs and ARIA attributes in the Captio…
Browse files Browse the repository at this point in the history
…ns Settings Dialog (#5153)

Fixes #4688 and #4884; supercedes 855adf3.
  • Loading branch information
OwenEdwards authored and gkatsev committed May 11, 2018
1 parent 8a08957 commit dc0d2bc
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 dc0d2bc

Please sign in to comment.