Fix launcher keyboard scrolling

This commit is contained in:
David Heinemeier Hansson
2026-06-28 20:46:46 -04:00
parent ba0d2a764f
commit 67084b153f
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -233,12 +233,14 @@ Item {
root.filterText = nextFilter root.filterText = nextFilter
root.selectedIndex = 0 root.selectedIndex = 0
root.cursorActive = true root.cursorActive = true
root.hoverArmed = false
root.rebuildDisplay() root.rebuildDisplay()
} }
function select(delta) { function select(delta) {
if (displayModel.count === 0) return if (displayModel.count === 0) return
root.cursorActive = true root.cursorActive = true
root.hoverArmed = false
root.selectedIndex = (root.selectedIndex + delta + displayModel.count) % displayModel.count root.selectedIndex = (root.selectedIndex + delta + displayModel.count) % displayModel.count
resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain) resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain)
} }
@@ -456,6 +458,7 @@ Item {
} else if (event.key === Qt.Key_Home) { } else if (event.key === Qt.Key_Home) {
if (displayModel.count > 0) { if (displayModel.count > 0) {
root.cursorActive = true root.cursorActive = true
root.hoverArmed = false
root.selectedIndex = 0 root.selectedIndex = 0
resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain) resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain)
} }
@@ -463,6 +466,7 @@ Item {
} else if (event.key === Qt.Key_End) { } else if (event.key === Qt.Key_End) {
if (displayModel.count > 0) { if (displayModel.count > 0) {
root.cursorActive = true root.cursorActive = true
root.hoverArmed = false
root.selectedIndex = displayModel.count - 1 root.selectedIndex = displayModel.count - 1
resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain) resultList.positionViewAtIndex(root.selectedIndex, ListView.Contain)
} }
+5
View File
@@ -68,6 +68,11 @@ assertEqual(acronymMatches[0], 'Google Contacts', 'short acronym matching still
const directMatches = search.sortedEntries(entries, 'obs').map(row => search.entryName(row.entry)) const directMatches = search.sortedEntries(entries, 'obs').map(row => search.entryName(row.entry))
assertEqual(directMatches[0], 'OBS Studio', 'direct app-name matching still works') assertEqual(directMatches[0], 'OBS Studio', 'direct app-name matching still works')
assert(
/function select\(delta\)[\s\S]*root\.hoverArmed = false[\s\S]*root\.selectedIndex =/.test(launcherQml),
'launcher keyboard navigation disarms stale hover before moving selection'
)
const confirmDeleteMatch = launcherQml.match(/function confirmDelete\(\) \{([\s\S]*?)\n \}/) const confirmDeleteMatch = launcherQml.match(/function confirmDelete\(\) \{([\s\S]*?)\n \}/)
assert(confirmDeleteMatch, 'launcher confirmDelete function exists') assert(confirmDeleteMatch, 'launcher confirmDelete function exists')
assert( assert(