Make every settings row reachable, and every accessibility switch honest
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -17,7 +17,16 @@ SettingRow {
|
||||
|
||||
controlWidth: 54
|
||||
|
||||
// Space and Enter do what a click does: ask for the other state and let
|
||||
// whoever owns that state decide, exactly as the pointer path does.
|
||||
function flip(): void {
|
||||
if (root.enabled)
|
||||
root.toggled(!root.checked);
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: pill
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 44
|
||||
@@ -26,6 +35,31 @@ SettingRow {
|
||||
color: root.checked ? Theme.accent : Theme.alpha(Theme.fg, 0.14)
|
||||
opacity: root.enabled ? 1 : 0.45
|
||||
|
||||
activeFocusOnTab: root.enabled
|
||||
|
||||
Accessible.role: Accessible.CheckBox
|
||||
Accessible.name: root.label
|
||||
Accessible.description: root.detail
|
||||
Accessible.checked: root.checked
|
||||
Accessible.focusable: root.enabled
|
||||
Accessible.focused: pill.activeFocus
|
||||
Accessible.onPressAction: root.flip()
|
||||
|
||||
Keys.onReturnPressed: root.flip()
|
||||
Keys.onEnterPressed: root.flip()
|
||||
Keys.onSpacePressed: root.flip()
|
||||
|
||||
// Focus ring only -- nothing is drawn here at rest.
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: -3
|
||||
radius: height / 2
|
||||
color: "transparent"
|
||||
visible: pill.activeFocus
|
||||
border.width: 2
|
||||
border.color: Theme.accentSecondary
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: root.checked ? parent.width - width - 3 : 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Reference in New Issue
Block a user