Enhance slide pruning logic to restore focus in TV mode after pruning slides
This commit is contained in:
@@ -2472,6 +2472,7 @@ const SlideshowManager = {
|
||||
pruneSlideCache() {
|
||||
const currentIndex = STATE.slideshow.currentSlideIndex;
|
||||
const keepRange = 5;
|
||||
let prunedAny = false;
|
||||
|
||||
Object.keys(STATE.slideshow.createdSlides).forEach((itemId) => {
|
||||
const index = STATE.slideshow.itemIds.indexOf(itemId);
|
||||
@@ -2503,10 +2504,24 @@ const SlideshowManager = {
|
||||
if (slide) slide.remove();
|
||||
|
||||
delete STATE.slideshow.createdSlides[itemId];
|
||||
prunedAny = true;
|
||||
|
||||
console.log(`Pruned slide ${itemId} at distance ${distance} from view`);
|
||||
}
|
||||
});
|
||||
|
||||
// After pruning, restore focus to container in TV mode
|
||||
if (prunedAny) {
|
||||
const isTvMode = (window.layoutManager && window.layoutManager.tv) ||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toggleMute() {
|
||||
|
||||
Reference in New Issue
Block a user