From 9844b186d72b93c9b0825891a952532e178df426 Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Thu, 12 Feb 2026 03:02:10 +0100 Subject: [PATCH] Enhance focus management in TV mode by delaying focus call after iframe removal --- .../Web/mediaBarEnhanced.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js index e5f89ae..4339345 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js +++ b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js @@ -611,7 +611,8 @@ const SlideUtils = { if (!container) { container = this.createElement("div", { id: "slides-container", - className: "noautofocus" + className: "noautofocus", + tabIndex: "-1" }); document.body.appendChild(container); } @@ -2516,10 +2517,13 @@ const SlideshowManager = { document.documentElement.classList.contains('layout-tv') || document.body.classList.contains('layout-tv'); if (isTvMode) { - const container = document.getElementById("slides-container"); - if (container) { - container.focus({ preventScroll: true }); - } + // Use setTimeout to execute AFTER Jellyfin's focus manager processes the iframe removal + setTimeout(() => { + const container = document.getElementById("slides-container"); + if (container && container.style.display !== 'none') { + container.focus({ preventScroll: true }); + } + }, 0); } } },