1

In a Mac SwiftUI project, I have a simple list inside a NavigationView. When I try to navigate using up/down arrow keys, the list will only scroll to one element off the screen in either direction. In other words, in screenshot below, if I click the down arrow, the view will scroll to show element 12, but won't scroll further to show element 13 or beyond(using the arrow keys. It will scroll further using the mouse). Is there a way to correct this so that arrow keys can navigate entire list?

enter image description here


struct ContentView: View {
    var body: some View {
        NavigationView{
            List{
                ForEach((1...100), id: \.self) { id in
                    
                    NavigationLink {
                        Text("Detail View")
                    } label: {
                        Text("\(id)")
                    }
                }
            }
        }
    }
}

Updated: I need to target MacOS 12 so NavigationSplitView isn't an option for me.

Martin
  • 1,570
  • 3
  • 19
  • 32

0 Answers0