Enhance focus management in TV mode by delaying focus call after iframe removal

This commit is contained in:
CodeDevMLH
2026-02-12 03:02:10 +01:00
parent 104b76aa41
commit 9844b186d7

View File

@@ -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);
}
}
},