From e0808743e488f482e2ba2b1cfc53bcf96fdb6143 Mon Sep 17 00:00:00 2001 From: Claire Kannapell Date: Wed, 2 Dec 2020 15:30:14 -0600 Subject: [PATCH 1/2] Re-select the caps button after closing modal --- .../control-bar/text-track-controls/subs-caps-button.js | 6 ++++++ src/js/tracks/text-track-settings.js | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/js/control-bar/text-track-controls/subs-caps-button.js b/src/js/control-bar/text-track-controls/subs-caps-button.js index 5667f6d9b1..c01c7ccb51 100644 --- a/src/js/control-bar/text-track-controls/subs-caps-button.js +++ b/src/js/control-bar/text-track-controls/subs-caps-button.js @@ -59,6 +59,12 @@ class SubsCapsButton extends TextTrackButton { return items; } + /** + * Re-open the caption list after modal close to promote accessibility + */ + reopenCaptionListAfterModalClose() { + this.pressButton(); + } } /** diff --git a/src/js/tracks/text-track-settings.js b/src/js/tracks/text-track-settings.js index 93fc94ab32..81ac1f0060 100644 --- a/src/js/tracks/text-track-settings.js +++ b/src/js/tracks/text-track-settings.js @@ -601,6 +601,14 @@ class TextTrackSettings extends ModalDialog { } } + /** + * Re-open the menu that triggered the modal to increase accessibility + */ + close() { + super.close(); + this.player().getChild('ControlBar').getChild('subsCapsButton').reopenCaptionListAfterModalClose(); + } + } Component.registerComponent('TextTrackSettings', TextTrackSettings); From 6160221af8ba27194fc442af9f1a66c8eb3cce35 Mon Sep 17 00:00:00 2001 From: Claire Kannapell Date: Wed, 2 Dec 2020 17:46:45 -0600 Subject: [PATCH 2/2] update unit test --- test/unit/tracks/text-track-settings.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/tracks/text-track-settings.test.js b/test/unit/tracks/text-track-settings.test.js index 443e9eda35..e85a3ad5a2 100644 --- a/test/unit/tracks/text-track-settings.test.js +++ b/test/unit/tracks/text-track-settings.test.js @@ -231,7 +231,7 @@ QUnit.test('should open on click', function(assert) { clock.restore(); }); -QUnit.test('should close on done click', function(assert) { +QUnit.test('should close and re-open menu on done click', function(assert) { const clock = sinon.useFakeTimers(); const player = TestHelpers.makePlayer({ tracks @@ -242,6 +242,7 @@ QUnit.test('should close on done click', function(assert) { Events.trigger(player.$('.vjs-texttrack-settings'), 'click'); Events.trigger(player.$('.vjs-done-button'), 'click'); assert.ok(player.textTrackSettings.hasClass('vjs-hidden'), 'settings closed'); + assert.ok(player.controlBar.subsCapsButton.menu.hasClass('vjs-lock-showing'), 'captions menu reopened'); player.dispose(); clock.restore();