diff --git a/installer-rs/crates/phoebus-installer/tests/live_iso.rs b/installer-rs/crates/phoebus-installer/tests/live_iso.rs index 8425de9..9ba8e16 100644 --- a/installer-rs/crates/phoebus-installer/tests/live_iso.rs +++ b/installer-rs/crates/phoebus-installer/tests/live_iso.rs @@ -226,3 +226,44 @@ fn installer_help_is_available_to_the_gui() { assert!(help.contains("deterministic `sys`")); assert!(help.contains("installation medium")); } + +#[test] +fn welcome_primary_action_is_keyboard_reachable() { + let qml = read("installer/live/desktop/phoebus-welcome/shell.qml"); + // The tiled window may not be focused at session start, so the launcher + // must request activation and force focus on the primary action; without + // this the focus ring (and Enter) never reach it. + assert!( + qml.contains("forceActiveFocus"), + "welcome never forces focus" + ); + assert!( + qml.contains("requestActivate"), + "welcome never requests activation" + ); + assert!( + qml.contains("id: installButton") || qml.contains("id: window"), + "welcome has no identifiable primary action" + ); + // Regression: `FloatingWindow` has no `onActiveChanged`; using it makes the + // whole configuration fail to load. + assert!( + !qml.contains("onActiveChanged"), + "welcome uses a non-existent FloatingWindow signal" + ); +} + +#[test] +fn progress_cannot_be_abandoned_silently() { + let qml = read("installer/live/desktop/phoebus-install/shell.qml"); + // Escape during the destructive stage must not close the frontend without + // an explanation. + assert!( + qml.contains("cannot be cancelled"), + "no truthful cancellation message" + ); + assert!( + qml.contains("shell.phase === \"progress\""), + "the guard against closing mid-install is missing" + ); +} diff --git a/installer/live/desktop/phoebus-install/shell.qml b/installer/live/desktop/phoebus-install/shell.qml index 122ffc5..07e5426 100644 --- a/installer/live/desktop/phoebus-install/shell.qml +++ b/installer/live/desktop/phoebus-install/shell.qml @@ -200,7 +200,10 @@ ShellRoot { } if (s === 2) { if (!shell.aiConnected) { - shell.status = "Connect and validate an AI model before continuing."; + // Show the guidance beside the AI controls, not only in the + // footer, so the fix is obvious. + shell.aiError = "Connect and validate a model before continuing."; + shell.status = ""; return; } saveAndAdvance(); @@ -460,9 +463,25 @@ ShellRoot { shell.advance(); } + Timer { + id: windowFocusTimer + interval: 700 + repeat: false + running: false + onTriggered: { + if (typeof window.requestActivate === "function") + window.requestActivate(); + page.forceActiveFocus(); + } + } + FloatingWindow { id: window - Component.onCompleted: { if (typeof window.requestActivate === "function") window.requestActivate(); } + Component.onCompleted: { + if (typeof window.requestActivate === "function") + window.requestActivate(); + windowFocusTimer.start(); + } visible: true color: Theme.charcoal implicitWidth: 980 @@ -491,7 +510,13 @@ ShellRoot { shell.back(); event.accepted = true; } else if (event.key === Qt.Key_Escape) { - shell.closeInstaller(); + // Closing the frontend mid-install would abandon a + // destructive operation without explanation. Refuse it and + // say so truthfully instead. + if (shell.phase === "progress") + shell.status = "The installation is in progress and cannot be cancelled safely. Wait for it to finish or for an error report." + else + shell.closeInstaller(); event.accepted = true; } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { shell.nextAction(); @@ -895,6 +920,7 @@ ShellRoot { visible: shell.phase === "progress" Text { text: "Installing Phoebus OS"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontTitle; font.weight: Font.DemiBold } Text { width: parent.width; text: "The stages below are the real backend stages. Downloads, compilation, configuration and verification are reported as they happen; no percentage is estimated."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap } + Text { width: parent.width; text: "This cannot be cancelled safely once disk changes begin. Leave the window open until the installation finishes or reports an error."; color: Theme.warning; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap } Rectangle { id: progressTrack width: parent.width; height: 6; radius: 3; color: Theme.border diff --git a/installer/live/desktop/phoebus-welcome/shell.qml b/installer/live/desktop/phoebus-welcome/shell.qml index 83ff26e..ed8cb7a 100644 --- a/installer/live/desktop/phoebus-welcome/shell.qml +++ b/installer/live/desktop/phoebus-welcome/shell.qml @@ -48,9 +48,28 @@ ShellRoot { } } + // The compositor may not have focused the tiled window yet at session + // start; request activation and, shortly after, force focus on the primary + // action so it is reachable with the keyboard (Enter). + Timer { + id: focusTimer + interval: 700 + repeat: false + running: false + onTriggered: { + if (typeof window.requestActivate === "function") + window.requestActivate(); + installButton.forceActiveFocus(); + } + } + FloatingWindow { id: window - Component.onCompleted: { if (typeof window.requestActivate === "function") window.requestActivate(); } + Component.onCompleted: { + if (typeof window.requestActivate === "function") + window.requestActivate(); + focusTimer.start(); + } visible: true color: Theme.charcoal implicitWidth: 940 @@ -167,6 +186,7 @@ ShellRoot { spacing: 20 PhoebusButton { + id: installButton label: "Install Phoebus OS" primary: true implicitHeight: 58