From 3177741ff8dbd98b853925f4a7d5760b2a2bd37d Mon Sep 17 00:00:00 2001 From: Andrew S Date: Sat, 5 Oct 2024 22:35:22 -0500 Subject: [PATCH] Fix invisible subtitles interaction --- chrome/player/ui/subtitles/SubtitlesManager.mjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chrome/player/ui/subtitles/SubtitlesManager.mjs b/chrome/player/ui/subtitles/SubtitlesManager.mjs index f4cf8eff..9567c124 100644 --- a/chrome/player/ui/subtitles/SubtitlesManager.mjs +++ b/chrome/player/ui/subtitles/SubtitlesManager.mjs @@ -624,6 +624,7 @@ export class SubtitlesManager extends EventEmitter { // Update elements const currentTime = this.client.state.currentTime; + let subtitlesVisible = 0; for (let i = 0; i < tracks.length; i++) { const trackContainer = cachedElements[i]; @@ -667,6 +668,7 @@ export class SubtitlesManager extends EventEmitter { trackContainer.style.opacity = ''; WebUtils.replaceChildrenPerformant(trackContainer, toAdd); + subtitlesVisible++; } } @@ -683,6 +685,13 @@ export class SubtitlesManager extends EventEmitter { } WebUtils.replaceChildrenPerformant(trackContainer, [this.testCue]); + subtitlesVisible++; + } + + if (subtitlesVisible) { + DOMElements.subtitlesContainer.style.display = ''; + } else { + DOMElements.subtitlesContainer.style.display = 'none'; } this.checkTrackBounds();