# Complete Focus Infrastructure & Navigation Audit — June 2026

Full cross-reference audit of all files in `ui/focus/`, `ui/sidebar/`, and `ui/navigation/`.
Methodology: read every file, then searched for every public symbol to determine caller count.

## Dead Code Inventory (16 components, ~1,027 lines)

| File | Symbol | Lines | Evidence |
|------|--------|-------|----------|
| `NavMenuData.kt` | Entire file | 33 | 0 callers. Superseded by `SidebarItems` |
| `FocusLinksBuilder.kt` | All 4 functions | 88 | `rememberSidebarFocusLinks`, `rememberCatalogCardFocusLinks`, `focusLinksProvider`, `sidebarFocusProperties` — 0 callers each |
| `UnifiedSidebar.kt` | Entire composable | 311 | 0 callers. Not wired to any scaffold or screen |
| `SidebarFocusRequesters.kt` | `rememberSidebarFocusRequesters` | 23 | 0 callers. Built for UnifiedSidebar only |
| `ContentFocusEntry.kt` | `ContentFocusEntry` + `requestFocusDelayed` | 58 | 0 callers |
| `ModalFocusHost.kt` | `ModalFocusHost` | 50 | 0 callers |
| `TvFocusRequester.kt` | `TvFocusRequester` | 49 | 0 callers outside definition |
| `DpadKeyHandler.kt` | Both `handleDPadKeyEvents` overloads | 95 | 0 callers. Duplicate in `util/DpadKeyEvents.kt` also unused |
| `PlaySoundEffect.kt` | Both `playSoundOnFocus` overloads | 58 | 0 callers. JVM overload ambiguity risk |
| `SettledFocus.kt` | `rememberSettledFocus` | 47 | 0 callers |
| `SettledFocusDetector.kt` | `rememberSettledFocusState` | 74 | 0 callers |
| `FocusRestorer.kt` | `RestoreContentFocusEffect` + `RequestFocusAfterFramesEffect` | 35 | 0 callers |
| `TvFocusModifiers.kt` | `tvFocusableCard` | ~40 | 0 callers. `tvFocusableRow` IS active (CatalogRail) |
| `TvFocusModifiers.kt` | `handleTvDirectionalKeys` | ~20 | 0 callers |
| `FocusRestorationState.kt` | `rememberFocusRestorationState` | 39 | 0 callers. Superseded by `HomeScreenFocusState` |
| `GlassSidebar.kt` | `focusFirstSidebarItem` | ~7 | 0 callers |

## Active Components (verified with cross-reference search)

| File | Symbol | Callers |
|------|--------|---------|
| `FocusRegistry.kt` | `FocusRegistry` class | **0 callers** (imported but never instantiated) |
| `FocusLinks.kt` | `FocusLinks` | Used inline by GlassSidebar, PremiumContentCard |
| `FocusUtils.kt` | `rememberTvFocusState` | Used by UnifiedSidebarItem (dead path), referenced in SKILL.md patterns |
| `FocusVelocityTracker.kt` | `FocusVelocityTracker` | Referenced by SettledFocus/SettledFocusDetector (both dead) |
| `AppFocusMemory.kt` | `AppFocusMemory` | Used by PremiumSettingsHub, SettingsCategory, SettingsHubScreen |
| `HomeScreenFocusState.kt` | `HomeScreenFocusState` | Used by HomeViewModel |
| `TvFocusController.kt` | `TvFocusController` | Central controller — used by TvAppScaffold |
| `TvFocusState.kt` | `TvFocusState` | Used by TvFocusController |
| `LocalTvFocusController.kt` | `LocalTvFocusController` | Used by TvAppScaffold, FocusDebugOverlay, TvFocusModifiers |
| `TvFocusModifiers.kt` | `tvFocusableRow`, `blockContentFocusWhenInactive`, `rememberBringIntoViewRequester` | CatalogRail, TvAppScaffold |
| `FocusDebugOverlay.kt` | `FocusDebugOverlay` | TvAppScaffold (DEBUG-only) |
| `TvFocusZone.kt` | `TvFocusZone` | TvFocusController, TvFocusState, SettingsScreen, TvFocusModifiers |
| `FocusZone` (deprecated) | `FocusZone` | AppFocusMemory, TvAppScaffold callback, `toLegacy()` bridge |

## Sidebar Architecture (4 implementations, 1 active)

### ✅ GlassSidebar (`ui/scaffold/GlassSidebar.kt`, 309 lines) — Active
- LazyColumn-based, Glass-morphism visual style
- tv-material3 `Surface` for nav items
- Per-item `FocusRequester` via `mutableStateMapOf`
- D-pad Right closes sidebar + returns focus to content
- Animated width transition (collapsed ↔ expanded)
- `focusProperties`: left=Cancel, right=content, up/down=adjacent item

### ⚠️ UnifiedSidebar (`ui/sidebar/UnifiedSidebar.kt`, 311 lines) — Dead
- Lumera-inspired, different glass styling (glassPanel, glassSurface, glassFocusGlow)
- Profile header with avatar + debrid premium indicator
- Badge support for collapsed mode
- 0 callers — never wired to any scaffold

### ✅ NetflixSideNavigation (`ui/components/netflix/NetflixSideNavigation.kt`) — Active
- Used by `NetflixHomeScreen`

### ✅ CircularRailNavigation (`ui/components/CircularRailNavigation.kt`) — Active
- Used by `NavigationRailWrapper`

## Scaffold Chain (production path)

```
Screens (Home, Settings, Search, CatalogBrowser, NavigationRailWrapper)
  → UnifiedChromeScaffold    (ui/sidebar/ — 32 lines, thin wrapper)
    → GlassAppScaffold        (ui/scaffold/ — alias for TvAppScaffold)
      → TvAppScaffold         (ui/scaffold/ — 168 lines, root)
        → GlassSidebar        (ui/scaffold/ — 309 lines, actual sidebar)
```

**Naming issue:** `UnifiedChromeScaffold` delegates to `GlassSidebar`, not `UnifiedSidebar`. Name is misleading.

## Focus Zones

### Active (TvFocusZone) — 8 zones
Sidebar, Content, SettingsCategory, SettingsDetail, DetailsActions, SourceList, PlayerControls, ModalDialog

### Deprecated (FocusZone) — 6 zones, still in use
Sidebar, Content, Dialog, PlayerControls, SettingsLeftPane, SettingsRightPane
Used by: AppFocusMemory, TvAppScaffold callback parameter type.
Bridge: `TvFocusZone.toLegacy(): FocusZone`

## SidebarItems Route Gaps

`SidebarItems` defines 9 items but 3 have no Screen route:
- `anime` → navigates to route `anime` — no matching Screen/Route
- `downloads` → navigates to route `downloads` — no matching Screen/Route  
- `profile` → navigates to route `profile` — closest match is `profiles`

Clicking these will fall through NavHost (undefined behavior).

## Navigation Quality Issues

1. 33x identical `fadeIn(300)`/`fadeOut(300)` in NavHost — no DRY abstraction
2. No deeplink support
3. `PersonDetailScreen` takes `onBackPress` + `onNavigateToDetail` — inconsistent with other detail screens
4. `NavMenuData.kt` entire file is dead code (0 callers)

## Focus Infrastructure Quality Issues

1. **JVM overload ambiguity:** `playSoundOnFocus` has two overloads in same file (one with `effect: Int` default, one without)
2. **Deprecated FocusZone still active:** 3 files use `FocusZone` while 4 use `TvFocusZone`
3. **`contentFocusAllowed()` redundant check:** `activeZone != PlayerControls` (line 30) already covered by `activeZone == Content` (line 27)
4. **FocusRegistry bypassed:** Home screen uses its own `mutableMapOf` instead
5. **Two D-pad handler duplicates:** `DpadKeyHandler.kt` + `DpadKeyEvents.kt`, both unused
6. **`SettledFocus` + `SettledFocusDetector`** built but never wired — velocity tracking exists but no screen suppresses work during fast scroll
