# Onboarding Navigation Bugs — Fixed 2026-05-28

Three bugs in `OnboardingScreen.kt` (lines 210–827) that block users from completing onboarding.

## Bug 1 — Services Overview navigates to wrong steps (critical)

**File:** `app/src/main/java/com/nexstream/app/ui/screens/onboarding/OnboardingScreen.kt`, lines 213–214

**Root cause:** `ServicesOverviewPanel` step index constants stale after step list reshuffling:
```kotlin
// WRONG — Debrid "Set up →" goes to step 1 (self-loop), Trakt goes to step 2 (Debrid)
onConnectDebrid = { viewModel.goToStep(1) },
onConnectTrakt = { viewModel.goToStep(2) },
```

**Step mapping:**
| Index | Step | goToStep should be |
|-------|------|--------------------|
| 0 | Welcome | N/A |
| 1 | Services Overview | N/A (this IS step 1) |
| 2 | Debrid Services | 2 |
| 3 | Trakt Sync | 3 |
| 4 | Streaming Catalogs | N/A |

**Fix:**
```kotlin
onConnectDebrid = { viewModel.goToStep(2) },
onConnectTrakt = { viewModel.goToStep(3) },
```

## Bug 2 — Continue button only renders when connected

**Files:** `DebridStepPanel` line 596, `TraktStepPanel` line 729

```kotlin
// WRONG — button invisible unless connected; user sees only "Skip"
if (uiState.debridStatus == "connected") {
    Button(onClick = onContinue, ...) { Text("Continue →") }
}
```

**Fix — always render, ghost when not connected:**
```kotlin
val isConnected = uiState.debridStatus == "connected"
Button(
    onClick = { if (isConnected) onContinue() },
    colors = ButtonDefaults.colors(
        containerColor = if (isConnected) Accent else TextDisabled,
        contentColor = if (isConnected) Color.White else TextSecondary,
    ),
) { Text(if (isConnected) "Continue →" else "Skip →") }
```

## Bug 3 — Panels not scrollable, buttons cut off

**All step panels** used `Arrangement.Center` without `verticalScroll`. On 720p TVs, content with device code display + provider cards overflows, pushing action buttons off-screen.

**Fix — add verticalScroll to every step panel Column:**
```kotlin
// BEFORE
Column(
    modifier = modifier.fillMaxSize().padding(48.dp),
    verticalArrangement = Arrangement.Center,
)

// AFTER
Column(
    modifier = modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(48.dp),
)
```

Requires imports:
```kotlin
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
```

## Prevention checklist for future onboarding changes

1. After adding/removing/reordering steps, audit ALL `goToStep(N)` calls against the step index enum
2. Every step MUST have at least one always-visible button that advances to the next step
3. Content panels MUST be scrollable — never rely on `Arrangement.Center` alone on TV
4. Build and smoke-test on an actual TV device (not just emulator) before shipping
