Remove overlay pattern from tvOS search results to fix focus clipping

The backgroundStyle.ignoresSafeArea().overlay(ScrollView) pattern
clips the tvOS focus effect at the overlay boundary. On tvOS, render
the ScrollView directly so focus highlights can extend naturally.
This commit is contained in:
Arkadiusz Fal
2026-04-13 22:50:34 +02:00
parent 885c478857
commit d8722e6150

View File

@@ -907,19 +907,21 @@ struct SearchView: View {
@ViewBuilder
private var resultsViewWithLoading: some View {
if searchViewModel != nil {
#if os(tvOS)
ProgressView()
.accessibilityIdentifier("search.loading")
.frame(maxWidth: .infinity)
.padding(.top, 40)
#else
resultsBackgroundStyle.color
.ignoresSafeArea()
.overlay(
ScrollView {
VStack(spacing: 16) {
#if !os(tvOS)
// Filter strip at top (only for instances that support search filters)
if searchInstance?.supportsSearchFilters == true {
searchFiltersStrip
}
#endif
// Loading indicator
ProgressView()
.accessibilityIdentifier("search.loading")
.frame(maxWidth: .infinity)
@@ -927,12 +929,34 @@ struct SearchView: View {
}
}
)
#endif
}
}
@ViewBuilder
private var resultsView: some View {
if searchViewModel != nil {
#if os(tvOS)
ScrollView {
if layout == .list {
listResultsContent
} else {
gridResultsContent
}
}
.accessibilityLabel("search.results")
.background(
GeometryReader { geometry in
Color.clear
.onAppear {
viewWidth = geometry.size.width
}
.onChange(of: geometry.size.width) { _, newWidth in
viewWidth = newWidth
}
}
)
#else
resultsBackgroundStyle.color
.ignoresSafeArea()
.overlay(
@@ -956,6 +980,7 @@ struct SearchView: View {
}
)
)
#endif
}
}