1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-02 06:32:07 +02:00

fix: Ensure aria-labelledby values in track settings are valid (#8711)

This commit is contained in:
mister-ben 2024-05-06 18:58:47 +02:00 committed by GitHub
parent 3df0e9b7f4
commit ad3be357d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View File

@ -86,7 +86,7 @@ const selectConfigs = {
edgeStyle: {
selector: '.vjs-edge-style > select',
id: '%s',
id: '',
label: 'Text Edge Style',
options: [
['none', 'None'],
@ -99,7 +99,7 @@ const selectConfigs = {
fontFamily: {
selector: '.vjs-font-family > select',
id: 'captions-font-family-%s',
id: '',
label: 'Font Family',
options: [
['proportionalSansSerif', 'Proportional Sans-Serif'],
@ -114,7 +114,7 @@ const selectConfigs = {
fontPercent: {
selector: '.vjs-font-percent > select',
id: 'captions-font-size-%s',
id: '',
label: 'Font Size',
options: [
['0.50', '50%'],

View File

@ -23,3 +23,21 @@ QUnit.test('should associate with <select>s with <options>s', function(assert) {
"select property 'aria-labelledby' is included in its option's property 'aria-labelledby'"
);
});
QUnit.test('aria-labelledby values must be valid and unique', function(assert) {
const player = TestHelpers.makePlayer({
tracks
});
const albs = player.$$('.vjs-text-track-settings select[aria-labelledby]');
albs.forEach(el => {
const ids = el.getAttribute('aria-labelledby').split(' ');
const invalidIds = ids.find(id => {
return !(player.$(`#${id}`));
});
assert.notOk(invalidIds, `${el.id} has valid aria-labelledby ids`);
assert.ok((new Set(ids)).size === ids.length, `${el.id} does not contain duplicate ids`);
});
});