diff --git a/quickshell/Modals/Settings/SettingsSidebar.qml b/quickshell/Modals/Settings/SettingsSidebar.qml index 25bf0edd0..4dfc6d17a 100644 --- a/quickshell/Modals/Settings/SettingsSidebar.qml +++ b/quickshell/Modals/Settings/SettingsSidebar.qml @@ -55,6 +55,16 @@ Rectangle { autoExpandForTab(keyboardHighlightIndex); } + function ensureRowVisible(item) { + if (!item || sidebarFlickable.height <= 0) + return; + const itemY = item.mapToItem(sidebarFlickable.contentItem, 0, 0).y; + const viewH = sidebarFlickable.height; + if (itemY >= sidebarFlickable.contentY && itemY + item.height <= sidebarFlickable.contentY + viewH) + return; + sidebarFlickable.contentY = Math.max(0, Math.min(itemY - viewH / 4, sidebarFlickable.contentHeight - viewH)); + } + function selectHighlighted() { if (keyboardHighlightIndex < 0) return; @@ -723,6 +733,7 @@ Rectangle { } DankFlickable { + id: sidebarFlickable anchors.fill: parent clip: true contentHeight: sidebarColumn.height @@ -974,6 +985,10 @@ Rectangle { readonly property bool hasTab: categoryDelegate.modelData.tabIndex !== undefined && !categoryDelegate.modelData.children readonly property bool isActive: hasTab && root.currentIndex === categoryDelegate.modelData.tabIndex readonly property bool isHighlighted: hasTab && root.keyboardHighlightIndex === categoryDelegate.modelData.tabIndex + onIsHighlightedChanged: { + if (isHighlighted) + Qt.callLater(root.ensureRowVisible, categoryRow); + } color: { if (isActive) @@ -1069,6 +1084,10 @@ Rectangle { readonly property bool isActive: root.currentIndex === modelData.tabIndex readonly property bool isHighlighted: root.keyboardHighlightIndex === modelData.tabIndex + onIsHighlightedChanged: { + if (isHighlighted) + Qt.callLater(root.ensureRowVisible, childDelegate); + } width: childrenColumn.width height: Math.max(Theme.iconSize - 4, Theme.fontSizeSmall + 1) + Theme.spacingS * 2