Skip to content

Commit dc0d2bc

Browse files
OwenEdwardsgkatsev
authored andcommitted
fix: Remove spaces from element IDs and ARIA attributes in the Captions Settings Dialog (#5153)
Fixes #4688 and #4884; supercedes 855adf3.
1 parent 8a08957 commit dc0d2bc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/js/tracks/text-track-settings.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,19 +313,20 @@ class TextTrackSettings extends ModalDialog {
313313
createElSelect_(key, legendId = '', type = 'label') {
314314
const config = selectConfigs[key];
315315
const id = config.id.replace('%s', this.id_);
316+
const selectLabelledbyIds = [legendId, id].join(' ').trim();
316317

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

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

0 commit comments

Comments
 (0)