Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-select the caps button after closing modal #6971

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/js/control-bar/text-track-controls/subs-caps-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class SubsCapsButton extends TextTrackButton {
return items;
}

/**
* Re-open the caption list after modal close to promote accessibility
*/
reopenCaptionListAfterModalClose() {
this.pressButton();
}
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/js/tracks/text-track-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/unit/tracks/text-track-settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down