From 1fc609057e455411f34faa666e9961300ffa8e2a Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 15 Nov 2025 12:04:01 +0100 Subject: [PATCH] Fix horizontal content extending behind sidebar on iPad Modified HorizontalCells to conditionally apply edgesIgnoringSafeArea based on navigation style. In sidebar mode (iPad), content now respects safe areas and won't overlap with the sidebar. In tab mode (iPhone), content maintains full-width scrolling behavior. --- Shared/Videos/HorizontalCells.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Shared/Videos/HorizontalCells.swift b/Shared/Videos/HorizontalCells.swift index 129a57d4..296d0a90 100644 --- a/Shared/Videos/HorizontalCells.swift +++ b/Shared/Videos/HorizontalCells.swift @@ -5,6 +5,7 @@ struct HorizontalCells: View { var items = [ContentItem]() @Environment(\.loadMoreContentHandler) private var loadMoreContentHandler + @Environment(\.navigationStyle) private var navigationStyle @Default(.channelOnThumbnail) private var channelOnThumbnail @@ -33,7 +34,7 @@ struct HorizontalCells: View { #endif } .frame(height: cellHeight) - .edgesIgnoringSafeArea(.horizontal) + .modifier(ConditionalEdgeIgnoringSafeArea(navigationStyle: navigationStyle)) .animation(nil, value: contentItems.count) } @@ -57,6 +58,18 @@ struct HorizontalCells: View { } } +struct ConditionalEdgeIgnoringSafeArea: ViewModifier { + let navigationStyle: NavigationStyle + + func body(content: Content) -> some View { + if navigationStyle == .tab { + content.edgesIgnoringSafeArea(.horizontal) + } else { + content + } + } +} + struct HorizontalCells_Previews: PreviewProvider { static var previews: some View { HorizontalCells(items: ContentItem.array(of: Video.allFixtures))