8000 fix: removes duplicate id in text track settings (#8755) · videojs/video.js@a10d258 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit a10d258

Browse files
authored
fix: removes duplicate id in text track settings (#8755)
## Description Prevents a duplicate id in text track settings. Fixes #8754 ## Specific Changes proposed The text edge settings were erroneously duplicating the id generated for the background colour. Changes to a unique name. Adds a general test for duplicate ids. ## Requirements Checklist - [x] Feature implemented / Bug fixed - [ ] If necessary, more likely in a feature request than a bug fix - [x] Change has been verified in an actual browser (Chrome, Firefox, IE) - [x] Unit Tests updated or fixed - [ ] Docs/guides updated - [ ] Example created ([starter template on JSBin](https://codepen.io/gkatsev/pen/GwZegv?editors=1000#0)) - [x] Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab) - [x] Has no changes to JSDoc which cause `npm run docs:api` to error - [ ] Reviewed by Two Core Contributors
1 parent 8729e31 commit a10d258

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class TextTrackSettingsFont extends Component {
5858
player,
5959
{
6060
id_,
61-
legendId: `captions-background-${id_}`,
61+
legendId: `captions-edge-style-${id_}`,
6262
legendText: this.localize('Text Edge Style'),
6363
className: 'vjs-edge-style vjs-track-setting',
6464
selects: this.options_.fieldSets[1],

test/unit/tracks/text-track-settings.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,15 @@ QUnit.test('should associate <label>s with <select>s', function(assert) {
397397
);
398398

399399
});
400+
401+
QUnit.test('should not duplicate ids', function(assert) {
402+
const player = TestHelpers.makePlayer({
403+
tracks
404+
});
405+
406+
const elements = [...player.el().querySelectorAll('[id]')];
407+
const ids = elements.map(el => el.id);
408+
const duplicates = elements.filter(el => ids.filter(id => id === el.id).length > 1);
409+
410+
assert.strictEqual(duplicates.length, 0, 'there should be no duplicate ids');
411+
});

0 commit comments

Comments
 (0)
0