I did dig into your suggestion and the first issue is now solved by encapsulating the Text() and a Spacer() in a HStack(), using .contentShape(Rectangle()) and the onTabGesture {} on the HStack(). The frame() modifier is not needed.
The detail view is updated and sync when clicking on any part of the selection
struct MyOutLine: View {
let title:String
@Binding var itemString:String
@State private var selection: FileItem?
var body: some View {
List(selection: $selection) {
OutlineGroup(data, children: \.children) { item in
HStack {
Text ("\(item.description)")
Spacer()
}
.contentShape(Rectangle())
.onTapGesture {
selection = item
itemString = item.description
}
.listRowBackground(
selection == item ?
Color.gray
:nil
)
}
}
.listStyle(.sidebar)
.onAppear { itemString = "No selection"}
}
}
This does not help for listRowBackground()