Back Arrow Fingerprint Restoration Fix
A single-line fix with major impact on user experience. The on-screen back arrow (top-left of detail pages) now restores focus to the correct card — identical behavior to the remote's hardware back button.
The Problem
When using the on-screen back arrow to return from a detail page (book, podcast, playlist, etc.) to a grid/list page, focus always jumped to the first card instead of returning to the card the user navigated from. The remote's back button worked correctly.
Users expect "back" to mean "back to where I was." The back arrow violated that expectation on every single detail page in the app.
Root Cause
The router.beforeEach hook in tv-navigation.js uses document.activeElement to determine the navigation context. It distinguishes between:
- Forward navigation (clicking a library tab, search icon) — clears the destination's saved fingerprint so focus starts fresh
- Back navigation (remote back button) — preserves the fingerprint for restoration
The on-screen back arrow lives inside #appbar. The isExplicitNavElement check matched any focused element inside #appbar, #bookshelf-navbar, or #bookshelf-toolbar — treating the back arrow identically to a forward navigation link. This caused the destination's saved fingerprint to be deleted just before navigation, so router.afterEach found no fingerprint and defaulted to the first card.
The remote back button was never affected because it fires via a Capacitor native listener while focus remains on a content card, bypassing the appbar check entirely.
Fix
Exclude the back arrow from the isExplicitNavElement check by detecting aria-label="Back". One condition added, zero side effects.
Affected Pages
Every detail page that has a back arrow — book details, podcast details, playlist details, collection details, series details, author details, episode details, history pages. All now correctly restore focus on back-arrow navigation.
Documentation
TV_FOCUS_SYSTEM.md updated with a new "Back Arrow vs Remote Back Button" section explaining the distinction and why the exclusion is necessary.