Restrict context menu overlay to iOS only

The tap-blocking overlay is only needed on iOS to dismiss the context menu
on tap. Removed it from macOS and tvOS where it was either blocking normal
interactions or not functional due to platform limitations.
This commit is contained in:
Arkadiusz Fal
2025-11-23 01:16:07 +01:00
parent 1eba731283
commit 6591d503d4

View File

@@ -33,23 +33,21 @@ struct VideoContextMenuView: View {
var body: some View {
ZStack {
#if os(iOS)
// Conditional overlay to block taps on underlying views
if isOverlayVisible {
Color.clear
.contentShape(Rectangle())
#if !os(tvOS)
// This is not available on tvOS < 16 so we leave out.
// TODO: remove #if when setting the minimum deployment target to >= 16
.onTapGesture {
// Dismiss overlay without triggering other interactions
isOverlayVisible = false
}
#endif
.ignoresSafeArea() // Ensure overlay covers the entire screen
.accessibilityLabel("Dismiss context menu")
.accessibilityHint("Tap to close the context")
.accessibilityAddTraits(.isButton)
}
#endif
if video.videoID != Video.fixtureID {
contextMenu