1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

fix: regression with AD audio track menu items (#7559)

In #7337, a lot of code was updated to no longer user innerHTML, but we
accidentally caused an issue with Audio Description (AD) tracks where
the track title was included twice. Once before and once after the AD
icon.

This is because we were calling `super.createEl()` but MenuItem created
a specific element and didn't just pass things the arguments along.
Instead, we should use `Dom.createEl()` directly.

Fixes #7556
This commit is contained in:
Gary Katsevman 2021-12-08 15:30:20 -05:00 committed by GitHub
parent 3c213455ee
commit 1d4bad8199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
*/
import MenuItem from '../../menu/menu-item.js';
import Component from '../../component.js';
import * as Dom from '../../utils/dom.js';
/**
* An {@link AudioTrack} {@link MenuItem}
@ -49,14 +50,14 @@ class AudioTrackMenuItem extends MenuItem {
const parentSpan = el.querySelector('.vjs-menu-item-text');
if (this.options_.track.kind === 'main-desc') {
parentSpan.appendChild(super.createEl('span', {
parentSpan.appendChild(Dom.createEl('span', {
className: 'vjs-icon-placeholder'
}, {
'aria-hidden': true
}));
parentSpan.appendChild(super.createEl('span', {
parentSpan.appendChild(Dom.createEl('span', {
className: 'vjs-control-text',
textContent: this.localize('Descriptions')
textContent: ' ' + this.localize('Descriptions')
}));
}