Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

Show focus rings for keyboard focus only and center settings

Bee3ebe29b9e892
diff --git a/android/gradlew b/android/gradlew
old mode 100644
new mode 100755
diff --git a/desktop/app/qml/Theme.qml b/desktop/app/qml/Theme.qml
index fd5dd95..5fe51ec 100644
--- a/desktop/app/qml/Theme.qml
+++ b/desktop/app/qml/Theme.qml
@@ -84,6 +84,12 @@ QtObject {
readonly property int gutter: layout.gutter
function space(step) { return Tokens.data.spacing.scale[step] }
+ // Focus rings show for keyboard focus only, not after a click (the
+ // web's :focus-visible).
+ function focusVisible(item) {
+ return item.activeFocus && (item.focusReason === Qt.TabFocusReason || item.focusReason === Qt.BacktabFocusReason)
+ }
+
// ---- Motion ----
// QML springs take a strength and a damping ratio; these are tuned to
// match the token springs (gentle / standard / snappy).
diff --git a/desktop/app/qml/components/Button.qml b/desktop/app/qml/components/Button.qml
index f4b814e..1917470 100644
--- a/desktop/app/qml/components/Button.qml
+++ b/desktop/app/qml/components/Button.qml
@@ -114,7 +114,7 @@ FocusScope {
color: "transparent"
border.width: 2
border.color: Theme.primary
- visible: button.activeFocus
+ visible: Theme.focusVisible(button)
}
HoverHandler { id: hover; cursorShape: button.interactive ? Qt.PointingHandCursor : Qt.ArrowCursor }
diff --git a/desktop/app/qml/components/CaptionButtons.qml b/desktop/app/qml/components/CaptionButtons.qml
index f8df244..ed66b91 100644
--- a/desktop/app/qml/components/CaptionButtons.qml
+++ b/desktop/app/qml/components/CaptionButtons.qml
@@ -89,7 +89,7 @@ Row {
color: "transparent"
border.width: 2
border.color: Theme.primary
- visible: button.activeFocus
+ visible: Theme.focusVisible(button)
}
HoverHandler { id: hover; enabled: !button.nativeInput }
TapHandler { id: tap; enabled: !button.nativeInput; onTapped: button.activated() }
diff --git a/desktop/app/qml/components/IconButton.qml b/desktop/app/qml/components/IconButton.qml
index 6a19db9..3a616a8 100644
--- a/desktop/app/qml/components/IconButton.qml
+++ b/desktop/app/qml/components/IconButton.qml
@@ -55,7 +55,7 @@ FocusScope {
color: "transparent"
border.width: 2
border.color: Theme.primary
- visible: button.activeFocus
+ visible: Theme.focusVisible(button)
}
HoverHandler { id: hover; cursorShape: Qt.PointingHandCursor }
diff --git a/desktop/app/qml/components/NavItem.qml b/desktop/app/qml/components/NavItem.qml
index cb4f9ef..41c560d 100644
--- a/desktop/app/qml/components/NavItem.qml
+++ b/desktop/app/qml/components/NavItem.qml
@@ -57,7 +57,7 @@ FocusScope {
color: "transparent"
border.width: 2
border.color: Theme.primary
- visible: item.activeFocus
+ visible: Theme.focusVisible(item)
}
HoverHandler { id: hover; cursorShape: Qt.PointingHandCursor }
TapHandler { id: tap; onTapped: item.clicked() }
diff --git a/desktop/app/qml/components/Segmented.qml b/desktop/app/qml/components/Segmented.qml
index c4dd4ff..8bbbd3e 100644
--- a/desktop/app/qml/components/Segmented.qml
+++ b/desktop/app/qml/components/Segmented.qml
@@ -46,7 +46,7 @@ Rectangle {
radius: Theme.pill(height)
color: option.selected ? (Theme.graphite ? Theme.surfaceContent : Theme.surface) : "transparent"
Behavior on color { ColorAnimation { duration: Theme.fadeFast } }
- border.width: option.activeFocus ? 2 : 0
+ border.width: Theme.focusVisible(option) ? 2 : 0
border.color: Theme.primary
}
Txt {
diff --git a/desktop/app/qml/components/Toggle.qml b/desktop/app/qml/components/Toggle.qml
index 7f54a79..f22ca7f 100644
--- a/desktop/app/qml/components/Toggle.qml
+++ b/desktop/app/qml/components/Toggle.qml
@@ -56,7 +56,7 @@ FocusScope {
color: "transparent"
border.width: 2
border.color: Theme.primary
- visible: toggle.activeFocus
+ visible: Theme.focusVisible(toggle)
}
HoverHandler { cursorShape: Qt.PointingHandCursor }
TapHandler { id: tap; onTapped: toggle.toggled(!toggle.checked) }
diff --git a/desktop/app/qml/pages/SettingsPage.qml b/desktop/app/qml/pages/SettingsPage.qml
index c2928f8..fef622d 100644
--- a/desktop/app/qml/pages/SettingsPage.qml
+++ b/desktop/app/qml/pages/SettingsPage.qml
@@ -35,9 +35,10 @@ Item {
Column {
id: column
- x: Theme.contentPadding
+ // A readable column, centered in wide windows.
+ width: Math.min(760, parent.width - Theme.contentPadding * 2)
+ x: Math.max(Theme.contentPadding, (parent.width - width) / 2)
y: Theme.contentPadding
- width: Math.min(720, parent.width - Theme.contentPadding * 2)
spacing: Theme.gutter
// ---- Appearance ----