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:
parent
cc23df69de
commit
613e383082
3 changed files with 91 additions and 4 deletions
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,6 +510,12 @@ ShellRoot {
|
|||
shell.back();
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Escape) {
|
||||
// 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) {
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue