diff --git a/src/components/subtitlesync/subtitlesync.js b/src/components/subtitlesync/subtitlesync.js index 07ce2cb7ec..23d0d07a04 100644 --- a/src/components/subtitlesync/subtitlesync.js +++ b/src/components/subtitlesync/subtitlesync.js @@ -1,4 +1,4 @@ -define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitlesync'], function (playbackManager, template, css) { +define(['playbackManager', 'layoutManager', 'text!./subtitlesync.template.html', 'css!./subtitlesync'], function (playbackManager, layoutManager, template, css) { "use strict"; var player; @@ -10,6 +10,7 @@ define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitles function init(instance) { var parent = document.createElement('div'); + document.body.appendChild(parent); parent.innerHTML = template; subtitleSyncSlider = parent.querySelector(".subtitleSyncSlider"); @@ -17,6 +18,14 @@ define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitles subtitleSyncCloseButton = parent.querySelector(".subtitleSync-closeButton"); subtitleSyncContainer = parent.querySelector(".subtitleSyncContainer"); + if (layoutManager.tv) { + subtitleSyncSlider.classList.add("focusable"); + // HACK: Delay to give time for registered element attach (Firefox) + setTimeout(function () { + subtitleSyncSlider.enableKeyboardDragging(); + }, 0); + } + subtitleSyncContainer.classList.add("hide"); subtitleSyncTextField.updateOffset = function(offset) { @@ -87,8 +96,6 @@ define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitles SubtitleSync.prototype.toggle("forceToHide"); }); - document.body.appendChild(parent); - instance.element = parent; }