From ecef37c1fcc998d043db68002ffc71b2365f631f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20M=2E?= <34163393+amtins@users.noreply.github.com> Date: Wed, 30 Oct 2024 09:35:04 +0100 Subject: [PATCH 1/5] fix(text-track-settings): localization not correctly applied (#8904) Localization is not applied correctly in fieldset labels and select options. As a result, the text track setting modal dialog is only half translated. - add `localize` at `label` level in `TextTrackFieldset` - add `localize` at `option` level in `TextTrackSelect` - add test cases --- src/js/tracks/text-track-fieldset.js | 2 +- src/js/tracks/text-track-select.js | 2 +- test/unit/tracks/text-track-settings.test.js | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/js/tracks/text-track-fieldset.js b/src/js/tracks/text-track-fieldset.js index b8f69df9f..945c21cf6 100644 --- a/src/js/tracks/text-track-fieldset.js +++ b/src/js/tracks/text-track-fieldset.js @@ -87,7 +87,7 @@ class TextTrackFieldset extends Component { const label = Dom.createEl('label', { id, className: 'vjs-label', - textContent: selectConfig.label + textContent: this.localize(selectConfig.label) }); label.setAttribute('for', guid); diff --git a/src/js/tracks/text-track-select.js b/src/js/tracks/text-track-select.js index 288bc55b7..99bb538ee 100644 --- a/src/js/tracks/text-track-select.js +++ b/src/js/tracks/text-track-select.js @@ -68,7 +68,7 @@ class TextTrackSelect extends Component { { id: optionId, value: this.localize(optionText[0]), - textContent: optionText[1] + textContent: this.localize(optionText[1]) } ); diff --git a/test/unit/tracks/text-track-settings.test.js b/test/unit/tracks/text-track-settings.test.js index e20a93664..1eec3e6ae 100644 --- a/test/unit/tracks/text-track-settings.test.js +++ b/test/unit/tracks/text-track-settings.test.js @@ -375,10 +375,16 @@ QUnit.test('should update on languagechange', function(assert) { tracks }); - videojs.addLanguage('test', {'Font Size': 'FONTSIZE'}); + videojs.addLanguage('test', { + 'Font Size': 'FONTSIZE', + 'Color': 'COLOR', + 'White': 'WHITE' + }); player.language('test'); assert.equal(player.$('.vjs-font-percent legend').textContent, 'FONTSIZE', 'settings dialog updates on languagechange'); + assert.equal(player.$('.vjs-text-color label').textContent, 'COLOR', 'settings dialog label updates on languagechange'); + assert.equal(player.$('.vjs-text-color select option').textContent, 'WHITE', 'settings dialog select updates on languagechange'); player.dispose(); }); From d0cf139384ada22f4b8d48d6696e37b4e64ddc43 Mon Sep 17 00:00:00 2001 From: mister-ben <1676039+mister-ben@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:21:07 +0100 Subject: [PATCH 2/5] fix: Fix Escape handling in menus (#8916) Fixes that Escape being pressed isn't closing menus due to incorrect `event.key` name. --- src/js/menu/menu-button.js | 6 +++--- test/unit/menu.test.js | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/js/menu/menu-button.js b/src/js/menu/menu-button.js index 73fecada3..7672779bd 100644 --- a/src/js/menu/menu-button.js +++ b/src/js/menu/menu-button.js @@ -297,7 +297,7 @@ class MenuButton extends Component { handleKeyDown(event) { // Escape or Tab unpress the 'button' - if (event.key === 'Esc' || event.key === 'Tab') { + if (event.key === 'Escape' || event.key === 'Tab') { if (this.buttonPressed_) { this.unpressButton(); } @@ -328,7 +328,7 @@ class MenuButton extends Component { */ handleMenuKeyUp(event) { // Escape hides popup menu - if (event.key === 'Esc' || event.key === 'Tab') { + if (event.key === 'Escape' || event.key === 'Tab') { this.removeClass('vjs-hover'); } } @@ -356,7 +356,7 @@ class MenuButton extends Component { */ handleSubmenuKeyDown(event) { // Escape or Tab unpress the 'button' - if (event.key === 'Esc' || event.key === 'Tab') { + if (event.key === 'Escape' || event.key === 'Tab') { if (this.buttonPressed_) { this.unpressButton(); } diff --git a/test/unit/menu.test.js b/test/unit/menu.test.js index bf47806b2..b07de00d4 100644 --- a/test/unit/menu.test.js +++ b/test/unit/menu.test.js @@ -235,7 +235,7 @@ QUnit.test('should remove old event listeners when the menu item adds to the new assert.ok(clickListenerSpy.calledOnce, 'click event listener should be called'); assert.strictEqual(clickListenerSpy.getCall(0).args[0].target, menuItem.el(), 'event target should be the `menuItem`'); - assert.ok(unpressButtonSpy.calledOnce, '`menuButton`.`unpressButtion` has been called'); + assert.ok(unpressButtonSpy.calledOnce, '`menuButton`.`unpressButton` has been called'); assert.ok(focusSpy.calledOnce, '`menuButton`.`focus` has been called'); unpressButtonSpy.restore(); @@ -265,3 +265,21 @@ QUnit.test('should remove old event listeners when the menu item adds to the new oldMenu.dispose(); menuButton.dispose(); }); + +QUnit.test('Escape should close menu', function(assert) { + const player = TestHelpers.makePlayer(); + const menuButton = new MenuButton(player, {}); + const unpressButtonSpy = sinon.spy(menuButton, 'unpressButton'); + + menuButton.createItems = () => [new MenuItem(player, {})]; + menuButton.update(); + menuButton.handleClick(new window.PointerEvent('click')); + menuButton.menu.children()[0].el_.dispatchEvent(new window.KeyboardEvent('keydown', { + key: 'Escape', + bubbles: true, + cancelable: true + })); + + assert.ok(unpressButtonSpy.calledOnce, '`menuButton`.`unpressButton` has been called'); + +}); From 079cbe1506166026511c01bd48a0bb192699870d Mon Sep 17 00:00:00 2001 From: Bruce Bailey Date: Thu, 14 Nov 2024 03:22:00 -0500 Subject: [PATCH 3/5] fix: change http to https in examples (#8905) Change examples to use https and not http. Co-authored-by: mister-ben <1676039+mister-ben@users.noreply.github.com> --- docs/examples/elephantsdream/index.html | 4 ++-- docs/examples/simple-embed/index.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/examples/elephantsdream/index.html b/docs/examples/elephantsdream/index.html index 808171ee5..832885303 100644 --- a/docs/examples/elephantsdream/index.html +++ b/docs/examples/elephantsdream/index.html @@ -5,8 +5,8 @@ Video.js Text Descriptions, Chapters & Captions Example - - + + diff --git a/docs/examples/simple-embed/index.html b/docs/examples/simple-embed/index.html index 5f109248d..e2b44a86b 100644 --- a/docs/examples/simple-embed/index.html +++ b/docs/examples/simple-embed/index.html @@ -10,9 +10,9 @@