fix(gui): focus the welcome action and refuse silent mid-install exit

The tiled welcome window was not keyboard-focused, so the primary action
had no focus ring and Return did nothing; request activation and force
focus. Refuse Escape during the destructive phase and say the operation
cannot be cancelled. Show the AI connection guidance beside the controls.
Guard the fixes with live_iso tests.
This commit is contained in:
Phoebus 2026-09-21 20:01:58 -07:00
parent cc23df69de
commit 613e383082
3 changed files with 91 additions and 4 deletions

View file

@ -226,3 +226,44 @@ fn installer_help_is_available_to_the_gui() {
assert!(help.contains("deterministic `sys`")); assert!(help.contains("deterministic `sys`"));
assert!(help.contains("installation medium")); 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"
);
}

View file

@ -200,7 +200,10 @@ ShellRoot {
} }
if (s === 2) { if (s === 2) {
if (!shell.aiConnected) { 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; return;
} }
saveAndAdvance(); saveAndAdvance();
@ -460,9 +463,25 @@ ShellRoot {
shell.advance(); shell.advance();
} }
Timer {
id: windowFocusTimer
interval: 700
repeat: false
running: false
onTriggered: {
if (typeof window.requestActivate === "function")
window.requestActivate();
page.forceActiveFocus();
}
}
FloatingWindow { FloatingWindow {
id: window id: window
Component.onCompleted: { if (typeof window.requestActivate === "function") window.requestActivate(); } Component.onCompleted: {
if (typeof window.requestActivate === "function")
window.requestActivate();
windowFocusTimer.start();
}
visible: true visible: true
color: Theme.charcoal color: Theme.charcoal
implicitWidth: 980 implicitWidth: 980
@ -491,7 +510,13 @@ ShellRoot {
shell.back(); shell.back();
event.accepted = true; event.accepted = true;
} else if (event.key === Qt.Key_Escape) { } 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; event.accepted = true;
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
shell.nextAction(); shell.nextAction();
@ -895,6 +920,7 @@ ShellRoot {
visible: shell.phase === "progress" 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 { 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: "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 { Rectangle {
id: progressTrack id: progressTrack
width: parent.width; height: 6; radius: 3; color: Theme.border width: parent.width; height: 6; radius: 3; color: Theme.border

View file

@ -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 { FloatingWindow {
id: window id: window
Component.onCompleted: { if (typeof window.requestActivate === "function") window.requestActivate(); } Component.onCompleted: {
if (typeof window.requestActivate === "function")
window.requestActivate();
focusTimer.start();
}
visible: true visible: true
color: Theme.charcoal color: Theme.charcoal
implicitWidth: 940 implicitWidth: 940
@ -167,6 +186,7 @@ ShellRoot {
spacing: 20 spacing: 20
PhoebusButton { PhoebusButton {
id: installButton
label: "Install Phoebus OS" label: "Install Phoebus OS"
primary: true primary: true
implicitHeight: 58 implicitHeight: 58