Skip to content

Commit 0af0e13

Browse files
committed
Fix keyboard navigation in Preferences > Appearance
1 parent b7297fa commit 0af0e13

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

src/appshell/qml/Preferences/internal/ColorAndWallpaperSection.qml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ BaseSection {
3030

3131
navigation.direction: NavigationPanel.Both
3232

33+
property int navigationRowStart: 0
34+
3335
property alias wallpaperDialogTitle: wallpaperPicker.dialogTitle
3436

3537
property bool useColor: true
@@ -63,7 +65,7 @@ BaseSection {
6365

6466
navigation.name: "ColorBox"
6567
navigation.panel: root.navigation
66-
navigation.row: 0
68+
navigation.row: root.navigationRowStart
6769
navigation.column: 0
6870

6971
onToggled: {
@@ -80,7 +82,7 @@ BaseSection {
8082

8183
navigation.name: "ColorBox"
8284
navigation.panel: root.navigation
83-
navigation.row: 0
85+
navigation.row: root.navigationRowStart
8486
navigation.column: 1
8587

8688
onNewColorSelected: function(newColor) {
@@ -96,7 +98,7 @@ BaseSection {
9698

9799
navigation.name: "WallpaperBox"
98100
navigation.panel: root.navigation
99-
navigation.row: 1
101+
navigation.row: root.navigationRowStart + 1
100102
navigation.column: 0
101103

102104
onToggled: {
@@ -111,7 +113,7 @@ BaseSection {
111113
enabled: !root.useColor
112114

113115
navigation: root.navigation
114-
navigationRowOrderStart: 1
116+
navigationRowOrderStart: root.navigationRowStart + 1
115117
navigationColumnOrderStart: 1
116118

117119
onPathEdited: function(newPath) {

src/appshell/qml/Preferences/internal/PageSection.qml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@
1919
* You should have received a copy of the GNU General Public License
2020
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2121
*/
22-
import QtQuick 2.15
23-
import QtQuick.Layouts 1.15
22+
import QtQuick
23+
import QtQuick.Layouts
2424

25-
import Muse.UiComponents 1.0
25+
import Muse.Ui
26+
import Muse.UiComponents
2627

2728
BaseSection {
2829
id: root
2930

3031
title: qsTrc("appshell/preferences", "Page")
3132

33+
navigation.direction: NavigationPanel.Both
34+
3235
property alias scoreInversionEnabled: scoreInversionEnable.checked
3336
property alias isOnlyInvertInDarkTheme: isOnlyInvertInDarkTheme.checked
3437
property bool isCurrentThemeDark
@@ -85,8 +88,11 @@ BaseSection {
8588
id: colorAndWallpaper
8689

8790
enabled: !root.scoreInversionEnabled || (root.isOnlyInvertInDarkTheme && !root.isCurrentThemeDark)
88-
opacityOverride: enabled ? 1.0 : 0.6
91+
opacityOverride: enabled ? 1.0 : ui.theme.itemOpacityDisabled
8992

9093
wallpaperDialogTitle: qsTrc("appshell/preferences", "Choose notepaper")
94+
95+
navigation: root.navigation
96+
navigationRowStart: 1
9197
}
9298
}

src/framework/uicomponents/qml/Muse/UiComponents/FilePicker.qml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,30 @@ Item {
6565
id: filePickerModel
6666
}
6767

68-
QtObject {
68+
Item {
6969
id: prv
7070

7171
property bool isNavigationBoth: root.navigation && root.navigation.direction === NavigationPanel.Both
72+
73+
states: [
74+
State {
75+
when: prv.isNavigationBoth
76+
PropertyChanges {
77+
pathField.navigation.row: root.navigationRowOrderStart
78+
pathField.navigation.column: root.navigationColumnOrderStart
79+
80+
button.navigation.row: root.navigationRowOrderStart
81+
button.navigation.column: root.navigationColumnOrderStart + 1
82+
}
83+
},
84+
State {
85+
when: !prv.isNavigationBoth
86+
PropertyChanges {
87+
pathField.navigation.order: root.navigationRowOrderStart
88+
button.navigation.order: root.navigationRowOrderStart + 1
89+
}
90+
}
91+
]
7292
}
7393

7494
RowLayout {
@@ -90,10 +110,6 @@ Item {
90110
navigation.enabled: root.visible && root.enabled
91111
navigation.accessible.name: root.pathFieldTitle + " " + pathField.currentText
92112

93-
navigation.row: prv.isNavigationBoth ? root.navigationRowOrderStart : -1
94-
navigation.column: prv.isNavigationBoth ? root.navigationColumnOrderStart : -1
95-
navigation.order: prv.isNavigationBoth ? -1 : root.navigationRowOrderStart
96-
97113
onTextEditingFinished: function(newTextValue) {
98114
root.pathEdited(newTextValue)
99115
}
@@ -114,10 +130,6 @@ Item {
114130
accessible.name: root.pickerType === FilePicker.PickerType.File ? qsTrc("ui", "Choose file")
115131
: qsTrc("ui", "Choose directory")
116132

117-
navigation.row: prv.isNavigationBoth ? root.navigationRowOrderStart : -1
118-
navigation.column: prv.isNavigationBoth ? root.navigationColumnOrderStart + 1 : -1
119-
navigation.order: prv.isNavigationBoth ? -1 : root.navigationRowOrderStart + 1
120-
121133
onClicked: {
122134
switch (root.pickerType) {
123135
case FilePicker.PickerType.File: {

0 commit comments

Comments
 (0)