Scanner improvements.

This commit is contained in:
2026-02-14 05:03:04 +00:00
parent 47b690b4da
commit 38651241d7
2 changed files with 66 additions and 4 deletions
+20 -1
View File
@@ -764,7 +764,7 @@ function formatMatchedPeople(people: PersonMatch[]): MatchedPerson[] {
let searchTimeout: ReturnType<typeof setTimeout> | null = null;
const MAX_RESULTS = 100;
// Watch for detail page entry to focus the first interactive element
// Watch for detail page entry/exit to manage focus
watch(selectedItem, (item, oldItem) => {
if (item && !oldItem) {
// Skip auto-focus if we have a specific episode to focus on (from search)
@@ -773,6 +773,25 @@ watch(selectedItem, (item, oldItem) => {
}
// Entering detail page - focus Play button (row 2, col 0) after transition
focusAt(2, 0, 150);
} else if (!item && oldItem) {
// Leaving detail page (browser back, Escape, etc.) - restore focus to the item card
const page = currentView.value === 'series' ? 'series' : 'movies';
restoreFocusForPage(page);
}
});
// Focus search input by default on initial movies page load
let initialFocusDone = false;
watch([mediaIndex, currentView, searchQuery, selectedItem], ([index, view, query, item]) => {
if (!initialFocusDone && index && view === 'movies' && !query && !item) {
initialFocusDone = true;
// Focus search input on first movies page load
setTimeout(() => {
const searchInput = document.querySelector('.search-input') as HTMLInputElement;
if (searchInput) {
searchInput.focus();
}
}, 100);
}
});