Repository Public
1import MCCCore2import SwiftUI34/// A single-selection list row that is an explicit button.5///6/// On macOS 27, `List(selection:)` receives the click but never selects the row, so navigation lists7/// (sidebar, settings panes) do not rely on it: each row sets the selection itself and draws its own8/// highlight. Keyboard users reach the rows with Tab / full keyboard access and activate them with Space.9struct SelectableRow<Label: View>: View {10 let isSelected: Bool11 let identifier: String12 let action: () -> Void13 @ViewBuilder var label: () -> Label14 @Environment(\.mccTheme) private var theme1516 var body: some View {17 Button(action: action) {18 label()19 .frame(maxWidth: .infinity, alignment: .leading)20 .contentShape(Rectangle())21 }22 .buttonStyle(.plain)23 .accessibilityIdentifier(identifier)24 .accessibilityAddTraits(isSelected ? [.isSelected] : [])25 .listRowBackground(26 RoundedRectangle(cornerRadius: 6, style: .continuous)27 .fill(isSelected ? Color.accentColor.opacity(0.22) : Color.clear)28 .padding(.horizontal, 6)29 )30 }31}32