Improve keyboard navigation

This commit is contained in:
Damiano Galassi committed 2024-07-22 10:06:33 +02:00
1 parent ad6c9dd132
commit e7a4d7af09
9 files changed
+43 -6

No files matched your search

+8
View File
@@ -67,6 +67,14 @@ class CollectionView: NSCollectionView, NSUserInterfaceValidations {
else if key == 27 && isSelected {
deselectAll(self)
}
else if self.isSelectionEmpty && (key == NSUpArrowFunctionKey || key == NSDownArrowFunctionKey) {
let indexPathSet = Set([IndexPath(item: 0, section: 0)])
animator().selectItems(at: indexPathSet, scrollPosition: .bottom)
delegate?.collectionView?(self, didSelectItemsAt: indexPathSet)
}
else if self.isSelectionEmpty && (key == NSRightArrowFunctionKey || key == NSLeftArrowFunctionKey) {
self.window?.windowController?.keyDown(with: event)
}
else {
super.keyDown(with: event)
}