Make tvOS Home section headers non-focusable

Render section headers as plain Text on tvOS so the focus engine
skips them and moves directly between video cards across sections.
iOS and macOS keep the tappable Button with chevron unchanged.
This commit is contained in:
Arkadiusz Fal
2026-04-17 05:41:38 +02:00
parent 060cff1449
commit f2a5069cd2

View File

@@ -211,6 +211,12 @@ struct HomeView: View {
// MARK: - Section Header Helper
private func sectionHeader(title: LocalizedStringKey, action: @escaping () -> Void) -> some View {
Group {
#if os(tvOS)
Text(title)
.fontWeight(.semibold)
.foregroundStyle(Color.accentColor)
#else
Button(action: action) {
HStack(spacing: 4) {
Text(title)
@@ -221,6 +227,8 @@ struct HomeView: View {
.foregroundStyle(Color.accentColor)
}
.buttonStyle(.plain)
#endif
}
.padding(.horizontal, listStyle == .inset ? 32 : 16)
.padding(.top, 16)
#if os(tvOS)
@@ -1203,6 +1211,12 @@ struct HomeView: View {
let limitedVideos = Array(videos.prefix(sectionItemsLimit))
VStack(alignment: .leading, spacing: 0) {
Group {
#if os(tvOS)
Text(verbatim: "\(contentType.localizedTitle) - \(instance.displayName)")
.fontWeight(.semibold)
.foregroundStyle(Color.accentColor)
#else
Button {
appEnvironment?.navigationCoordinator.navigate(
to: .instanceBrowse(instance, initialTab: contentType.toBrowseTab())
@@ -1217,9 +1231,15 @@ struct HomeView: View {
.foregroundStyle(Color.accentColor)
}
.buttonStyle(.plain)
#endif
}
.padding(.horizontal, listStyle == .inset ? 32 : 16)
.padding(.top, 16)
#if os(tvOS)
.padding(.bottom, 24)
#else
.padding(.bottom, 8)
#endif
.frame(maxWidth: .infinity, alignment: .leading)
if sectionLayout == .grid {