diff --git a/crates/qbz-slint/ui/primitives/CircleAction.slint b/crates/qbz-slint/ui/primitives/CircleAction.slint index db82ae23a..8109c4a19 100644 --- a/crates/qbz-slint/ui/primitives/CircleAction.slint +++ b/crates/qbz-slint/ui/primitives/CircleAction.slint @@ -62,6 +62,32 @@ export component CircleAction inherits Rectangle { y: Math.round((parent.height - self.height) / 2 / 1px) * 1px; } + // Keyboard activation: Enter/Space fire the same click. The TouchArea below + // stays the pointer source; this only adds key activation + focusability. + fs := FocusScope { + enabled: root.enabled; + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.clicked(); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, circular to match the button so it never reflows. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: root.diameter / 2; + } + ta := TouchArea { mouse-cursor: root.enabled ? pointer : default; clicked => { diff --git a/crates/qbz-slint/ui/primitives/QbzCheckbox.slint b/crates/qbz-slint/ui/primitives/QbzCheckbox.slint index ed3128b6b..77a4ae0e5 100644 --- a/crates/qbz-slint/ui/primitives/QbzCheckbox.slint +++ b/crates/qbz-slint/ui/primitives/QbzCheckbox.slint @@ -31,4 +31,30 @@ export component QbzCheckbox inherits Rectangle { root.toggled(); } } + + // Keyboard activation: Enter/Space toggle the box, same as a click. The + // TouchArea stays the pointer source; this only adds key activation + focus. + fs := FocusScope { + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.checked = !root.checked; + root.toggled(); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, so it never reflows the checkbox. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: parent.border-radius; + } } diff --git a/crates/qbz-slint/ui/primitives/QbzSelect.slint b/crates/qbz-slint/ui/primitives/QbzSelect.slint index 1d8be8782..4aa80d7d5 100644 --- a/crates/qbz-slint/ui/primitives/QbzSelect.slint +++ b/crates/qbz-slint/ui/primitives/QbzSelect.slint @@ -155,6 +155,34 @@ export component QbzSelect inherits Rectangle { } } + // Keyboard activation: Enter/Space open the option list, same as a click. + // The TouchArea stays the pointer source; this only adds key activation + + // focusability on the collapsed control. + fs := FocusScope { + enabled: root.enabled; + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.filter = ""; + popup.show(); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, matching the control's radius so it never reflows. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: parent.border-radius; + } + popup := PopupWindow { // Right-anchored so a list wider than the control grows leftward // and stays on-screen. diff --git a/crates/qbz-slint/ui/primitives/QbzToggle.slint b/crates/qbz-slint/ui/primitives/QbzToggle.slint index b6e123034..c9b3d7f0b 100644 --- a/crates/qbz-slint/ui/primitives/QbzToggle.slint +++ b/crates/qbz-slint/ui/primitives/QbzToggle.slint @@ -35,4 +35,30 @@ export component QbzToggle inherits Rectangle { } } } + + // Keyboard activation: Enter/Space flip the switch, same as a click. The + // TouchArea stays the pointer source; this only adds key activation + focus. + fs := FocusScope { + enabled: root.enabled; + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.toggled(!root.checked); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, matching the switch's pill radius so it never reflows. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: parent.border-radius; + } } diff --git a/crates/qbz-slint/ui/primitives/SecondaryButton.slint b/crates/qbz-slint/ui/primitives/SecondaryButton.slint index 9a0d762d1..881521488 100644 --- a/crates/qbz-slint/ui/primitives/SecondaryButton.slint +++ b/crates/qbz-slint/ui/primitives/SecondaryButton.slint @@ -47,4 +47,30 @@ export component SecondaryButton inherits Rectangle { } } } + + // Keyboard activation: Enter/Space fire the same click. The TouchArea stays + // the pointer source; this only adds key activation + focusability. + fs := FocusScope { + enabled: root.enabled; + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.clicked(); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, so it never reflows the button. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: parent.border-radius; + } } diff --git a/crates/qbz-slint/ui/primitives/ToggleButton.slint b/crates/qbz-slint/ui/primitives/ToggleButton.slint index 3eec061ea..2d044c7cb 100644 --- a/crates/qbz-slint/ui/primitives/ToggleButton.slint +++ b/crates/qbz-slint/ui/primitives/ToggleButton.slint @@ -36,4 +36,29 @@ export component ToggleButton inherits Rectangle { root.clicked(); } } + + // Keyboard activation: Enter/Space fire the same click. The TouchArea stays + // the pointer source; this only adds key activation + focusability. + fs := FocusScope { + key-pressed(event) => { + if (event.text == Key.Return || event.text == " ") { + root.clicked(); + return accept; + } + return reject; + } + } + + // Non-layout focus ring — transparent-bordered overlay shown only on + // keyboard focus, so it never reflows the toggle. + Rectangle { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + background: transparent; + border-width: 2px; + border-color: fs.has-focus ? Theme.focus-ring : transparent; + border-radius: parent.border-radius; + } }