From 3e17e4d8541937409eaed520e9a6aade524aa698 Mon Sep 17 00:00:00 2001 From: cvillasenor Date: Wed, 14 Aug 2024 12:04:00 -0600 Subject: [PATCH] fix: update style changes to be used in browsers --- src/js/tracks/text-track-display.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/js/tracks/text-track-display.js b/src/js/tracks/text-track-display.js index 87b784b52e..f52247deec 100644 --- a/src/js/tracks/text-track-display.js +++ b/src/js/tracks/text-track-display.js @@ -5,7 +5,6 @@ import Component from '../component'; import * as Fn from '../utils/fn.js'; import * as Dom from '../utils/dom.js'; import window from 'global/window'; -import * as browser from '../utils/browser'; /** @import Player from '../player' */ @@ -321,10 +320,14 @@ class TextTrackDisplay extends Component { this.updateForTrack(descriptionsTrack); } - if (browser.IS_SMART_TV && !window.CSS.supports('inset', '10px')) { + if (!window.CSS.supports('inset', '10px')) { const textTrackDisplay = this.el_; const vjsTextTrackCues = textTrackDisplay.querySelectorAll('.vjs-text-track-cue'); + // Clear inline style before getting actual height of textTrackDisplay + textTrackDisplay.style = ''; + const textTrackDisplayHeight = textTrackDisplay.getBoundingClientRect().height; + // vjsTextTrackCue style updates if (vjsTextTrackCues.length > 0) { vjsTextTrackCues.forEach((vjsTextTrackCue) => { @@ -336,6 +339,12 @@ class TextTrackDisplay extends Component { } }); } + + // textrack style updates, this styles are required to be inline + textTrackDisplay.style.position = 'relative'; + textTrackDisplay.style.height = textTrackDisplayHeight + 'px'; + textTrackDisplay.style.top = 'unset'; + textTrackDisplay.style.bottom = '0px'; } } @@ -347,17 +356,6 @@ class TextTrackDisplay extends Component { // inset-inline and inset-block are not supprted on old chrome, but these are // only likely to be used on TV devices if (!this.player_.videoHeight() || !window.CSS.supports('inset-inline: 10px')) { - if (browser.IS_SMART_TV && !window.CSS.supports('inset', '10px')) { - const textTrackDisplay = this.el_; - const textTrackDisplayHeight = textTrackDisplay.getBoundingClientRect().height; - - // textrack style updates, this styles are required to be inline - textTrackDisplay.style.position = 'relative'; - textTrackDisplay.style.height = textTrackDisplayHeight + 'px'; - textTrackDisplay.style.top = 'unset'; - textTrackDisplay.style.bottom = '0px'; - } - return; }